Refresh token using Omniauth-oauth2 in Rails application?

189 views
Skip to first unread message

Ganesh Ranganathan

unread,
Feb 14, 2014, 5:33:25 AM2/14/14
to rubyonra...@googlegroups.com

I am using omniauth-oauth2 in rails to authenticate to a site which supports oauth2. The site gives me after doing the oauth dance, which I then persist into the database

  1. Access Token
  2. Expires_AT (ticks)
  3. Refresh token

Is there an omniauth method to refresh the token automatically after it expires or should I write custom code which to do the same.

If custom code is to be written, is a helper the right place to write the logic?

Thanks,

Ganesh


Jordon Bedwell

unread,
Feb 14, 2014, 10:33:29 AM2/14/14
to rubyonra...@googlegroups.com
Last I remember omniauth does not support this at all. No, a helper
is not the best place to do it, you should probably either background
check the token and refresh it there or add it as a method to the user
model since it's related to the user and it's behavior.

Ganesh Ranganathan

unread,
Feb 24, 2014, 5:12:51 AM2/24/14
to rubyonra...@googlegroups.com

On Fri, Feb 14, 2014 at 9:03 PM, Jordon Bedwell <envy...@gmail.com> wrote:
Last I remember omniauth does not support this at all.  No, a helper
is not the best place to do it, you should probably either background
check the token and refresh it there or add it as a method to the user
model since it's related to the user and it's behavior

Thanks,

I added it to the User model which makes a rest-client call and gets the new refreshed code.


Cheers,
Ganesh


Reply all
Reply to author
Forward
0 new messages