omniauth-oauth2
omniauth-oauth2 copied to clipboard
Hash incompatibility with oauth2 gem
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
Do you have a patch for this? I would be happy to accept a pull request to make this easier to use.
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.