omniauth-youtube
omniauth-youtube copied to clipboard
No Refresh Token
I have the current setting for omniauth-youtube
Rails.application.config.middleware.use OmniAuth::Builder do
provider :youtube, ENV['YOUTUBE_KEY'], ENV['YOUTUBE_SECRET'], { access_type: 'offline', approval_prompt: '' }
end```
However, it is not returning refresh token from auth_hash. It returns
```ruby
...
"credentials" => {
"token" => "xxxxxxxxx",
"expires_at" => 1360645863,
"expires" => true
}
...
Is my setting wrong or do I need to request for users' refresh tokens specifically?
Hi,
I have same problem.
I have patched my local version of this gem. I will submit commit asap as I learn how to use git/github next week.
The issue was that 'access_type' was never defined in request to Google Oauth. https://developers.google.com/youtube/2.0/developers_guide_protocol#OAuth2_Server_Side_Web_Applications_Flow
hi @Netherdrake i think you have to keep options under :authorize_params
here is an example -
config.omniauth :youtube,
config_hash[Rails.env]['client_id'],
config_hash[Rails.env]['secret'],
authorize_params: { access_type: 'offline', approval_prompt: 'force' }
@we4tech Yes, that is correct.
But I have a bit complicated use case so I've tweaked it so authorize_params are not passed in initializer, but rather on demand.
Sounds good :)
Sent from my iPad
On Mar 4, 2013, at 7:52 PM, Netherdrake [email protected] wrote:
@we4tech Yes, that is correct.
But I have a bit complicated use case so I've tweaked it so authorize_params are not passed in initializer, but rather on demand.
— Reply to this email directly or view it on GitHub.
I'd be happy to merge a patch that allowed specifying this via params or otherwise. Thanks for reporting
I'd be happy to use this patch :)