omniauth-oauth2 icon indicating copy to clipboard operation
omniauth-oauth2 copied to clipboard

Hash incompatibility with oauth2 gem

Open dgertych-monterail opened this issue 11 years ago • 2 comments

Why it's not easy to use omniauth-oauth2 with https://github.com/intridea/oauth2?

From omniauth i get credentials hash like this:

credentials do
  hash = {'token' => access_token.token}
  hash.merge!('refresh_token' => access_token.refresh_token) if access_token.expires? && access_token.refresh_token
  hash.merge!('expires_at' => access_token.expires_at) if access_token.expires?
  hash.merge!('expires' => access_token.expires?)
  hash
end

https://github.com/intridea/omniauth-oauth2/blob/master/lib/omniauth/strategies/oauth2.rb#L41

And it's impossible to use OAuth2::AccessToken.from_hash() method without modify the credentials hash https://github.com/intridea/oauth2/blob/master/lib/oauth2/access_token.rb#L45

dgertych-monterail avatar Jun 04 '14 10:06 dgertych-monterail

Do you have a patch for this? I would be happy to accept a pull request to make this easier to use.

isaacsanders avatar Sep 24 '14 19:09 isaacsanders

I'm pretty sure this is fixed in newer oauth2 libraries. It checks for both Symbol and String keys which I assume was the issue here.

bjeanes avatar Nov 25 '16 07:11 bjeanes