I am new to Rails and new to extending Google Chrome and I am looking for some guidance.
I have a rails 3 app running on a server with user accounts and authentications. Sessions are maintained via a cookie on the client side until the user explicitly signs out.
If a user want 开发者_高级运维to use the extension, what needs to happen so that he is logged in "through the plugin".
So the user opens the plugin, it should check for the existence of a cookie to see if the user is logged in or not. If not, it should provide an interface to log in, if yes it should move on to whatever functionality it provides.
Is this the right idea? Are there resources where I could learn more about how to correctly set up this interaction?
Thank you for your help.
What authentication solution are you using, try using the authentication token in devise to log the user in from the plugin. When the user navigates to the site have the plugin request the page with the auth token parameter and that would allow you to verify the user and sign them in. After that all you have to do is maintain the session normally.
Devise Documentation: http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable
精彩评论