Closed Saoma1 closed 4 months ago
Hello @Saoma1
I just came across the same issue, and to get the callback phase being executed and having request.env["omniauth.auth"]
not nil, you can use the option callback_path
instead of redirect_uri
like so:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"],
{
callback_path: '/u/auth/google_oauth2/callback'
}
end
It comes from the gem omniauth, they check the current_path against a couple of strings including the callback_path option, see: https://github.com/omniauth/omniauth/blob/a13cd110beb9538ea51be6c614bf43351c3f4e95/lib/omniauth/strategy.rb#L194C4-L194C4
@karquelf thank you for the hint, I will check it out!
@karquelf thank you for the hint, I will check it out!
Did that solved, @Saoma1 ? I am using devise gem in combination with omniauth_google gem for auth purposes and having replaced the redirect_uri with callback_path did not worked for me
@karquelf thank you for the hint, I will check it out!
Did that solved, @Saoma1 ? I am using devise gem in combination with omniauth_google gem for auth purposes and having replaced the redirect_uri with callback_path did not worked for me
It is working now, I was providing the absolute_url instead of relative_url which I've now changed and it did the trick ! Thank you @karquelf , you saved my time
I would like to reopen an old issue
This still seams to be an problem, running
rails 7.0.4
&omniauth-google-oauth2 1.1.1
I am also not using devise but a custom solution for handling login etc.when i configure omniauth.rb without a custom redirect
this my output
however, with a custom redirect
my output shows that the callback phase is skipped which leads to
request.env["omniauth.auth"]
being nil