Closed franciscoml67 closed 7 years ago
A more detailed description of what is going on can be found here
update: the request.env['omniauth.params'] is coming in null from the callback, as well as request.env['omniauth.auth'] for that matter...
would really appreciate some help in this @lynndylanhurley ! thank you in advance
I'm also running into this issue. In my case, I am trying to perform hybrid auth with Google from an Ember app.
The Ember app posts the authorization here:
// routes.rb
post '/auth/:provider/callback', to: 'sessions#create'
which is handled by this controller:
class SessionsController < ApplicationController
def create
@account = Account.from_omniauth(request.env['omniauth.auth'])
session[:account_id] = @account.id
render json: { account: @account,
access_token: request.env['omniauth.auth']['credentials']['token'],
email: request.env['omniauth.auth']['info']['email'] }
end
end
with the initializer:
// initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
def google_oauth2_options
{
:provider_ignores_state => true,
:prompt => 'select_account consent',
:access_type => 'offline',
:scope => "email, profile, plus.me",
:redirect_uri => "http://localhost:4200/oauth2callback"
}
end
provider :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'], google_oauth2_options
end
Now, if I use just the omniauth package by itself, everything work fine. If I add this to the controller:
puts puts request.env['omniauth.auth'].to_yaml
I get an empty response using this library. If I use the omniauth-google-oauth2 gem by itself, I get:
ruby/hash:OmniAuth::AuthHash
provider: google_oauth2
uid: ...
info: !ruby/hash:OmniAuth::AuthHash::InfoHash
...
Hi there @franciscoml67 ,
In an effort to cleanup this project and prioritize a bit, we're marking issues that haven't had any activity in a while with a "close-in-7-days" label. If we don't hear from you in about a week, we'll be closing this issue. Obviously feel free to re-open it at any time if it's the right time or this was done in error!
If you are still having the issue (especially if it's a bug report) please refer to our new Issue Template to provide some more details to help us solve it.
Hope all is well.
hey @franciscoml67 @zachfeldman I'm having this same issue!
hey @franciscoml67 @zachfeldman I'm having this same issue!
@franciscoml67 did you find any solution ? Getting the same problem ...
Yes, I stopped using devise_token_auth and omniauth :)
I did it from scratch by myself. It is not this complicated and at least you have no issue!
Yes, I stopped using devise_token_auth and omniauth :)
I did it from scratch by myself. It is not this complicated and at least you have no issue!
Ahaha maybe I will do the same in a few hours 🤯🤯🤯
Trying a different version of omniauth-google-oauth2
gem solved the issue for me.
Error during Google OAuth callback: undefined method `persisted?' for nil:NilClass
how to solve this problem?
I think there's some kind of problem with this line of code in omniauth_callbacks_controller (line 14):
After successfully being prompted by facebook, the 'omniauth' object seems to be empty raising the following error:
I think this issue has been addressed before, but I think it wasn't solved and it has now, resurfaced.