开发者

Chrome extension session management: How to authorize user account on rails 3 back-end via plugin

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜