Google Login Not Working with Approved App

Hi all–

The Google login feature at orclimatehub.org is not working, even though the app is fully approved. The code we are using is identical to the code from another Sharetribe Go-based site we cloned, https://shareoregon.com. It has worked there without a problem for several years.

We think that the issue could be something with the app, but Google does not think so and everything including the redirect URLs seems to be perfect. We and Google have checked the app multiple times and tried every possible option, including recreating the app.

This is the Google setup code we are using:

def google_setup
request.env[“omniauth.strategy”].options[:client_id] = @current_community.google_connect_id || APP_CONFIG.google_client_id
request.env[“omniauth.strategy”].options[:client_secret] = @current_community.google_connect_secret || APP_CONFIG.google_client_secret
request.env[“omniauth.strategy”].options[:iframe] = true
request.env[“omniauth.strategy”].options[:scope] = “public_profile,email”
request.env[“omniauth.strategy”].options[:info_fields] = “name,email,last_name,first_name”

if @current_community.facebook_connect_enabled?
request.env[“omniauth.strategy”].options[:client_id] = @current_community.facebook_connect_id || APP_CONFIG.fb_connect_id
request.env[“omniauth.strategy”].options[:client_secret] = @current_community.facebook_connect_secret || APP_CONFIG.fb_connect_secret

else

# to prevent plain requests to /people/auth/facebook even when “login with Facebook” button is hidden

request.env[“omniauth.strategy”].options[:client_id] = “”

request.env[“omniauth.strategy”].options[:client_secret] = “”

request.env[“omniauth.strategy”].options[:client_options][:authorize_url] = login_url

request.env[“omniauth.strategy”].options[:client_options][:site_url] = login_url

end

render :plain => “Setup complete.”, :status => 404 #This notifies the ominauth to continue
end

The Google button appears, but when we click on the login button it redirects to this URL: https://accounts.google.com/signin/oauth/error?authError=

Any ideas of what else can we do? We have been stuck on this issue for quite a while and any help would be greatly appreciated!
Rick Reynolds

p.s. Thanks to the awesome Sharetribe team for everything y’all have done to make robust community-building sites like this possible! Y’all are the best!!

Hey @rick, and thanks for the kind words! Great to see the new marketplaces you’re building :slight_smile:

It seems that, in your Google Login settings (where you’ve configured the app settings/details, at Google’s), the redirect_uri is set to http://www.orclimatehub.org/people/auth/google_oauth2/callback.

In that URI, it seems to use http, instead of https. This may be enough to make things go wrong.

Would you have a chance to check? If http is indeed currently set, what if you change it to https? Does it help (note that there’s usually a few minutes delay, so wait up to 10-15 minutes to test properly)?

If that doesn’t help, I’d advise following the instructions (for the hosted version, but that should apply here too) at https://help.sharetribe.com/en/articles/2721120-configure-google-login. Pay attention to step 9: have you done changes that require your app to be validated, which can take a few days?

Hopefully, this helps. Keep us posted!

My pleasure and thanks a lot for the reply, @thomasmalbaux. Yes, Google shows the link with http:// and not https:// on the error page. However, since the app is approved and in production, the URIs entered in the Google Cloud Platform all need to be https://… Therefore, there doesn’t seem to be anything we can do about this issue. The URI suggested in the error just seems to generic and not taking into account that our app is in production and requires https:// URIs, unless we’re missing something?

We’ve followed all your steps on the “Configure Google Login” page and the app has been validated and fully approved by Google. It’s such a mystery why it won’t work, so any other ideas would be appreciated if your or anyone else has them, too!

Thanks so much for everything,
Rick

Oh, that’s interesting, I didn’t know that about the confusing/not-so-perfect error message. Thanks for sharing that information.

Hmm that’s strange. From the top of my head no, I don’t know what could be wrong.

We’ve seen, every now and then, with customers of the hosted version, this kind of dead-end. Usually, it was because of an incorrect redirect_uri but in some rare cases, there was nothing to do. The only solution was to delete the app at Google and start again, from scratch.

Have you tried that already? If not, would you have a chance to test? Do you end up in the same situation if you start again from scratch?

Thanks a lot, @thomasmalbaux . Yes, we’ve tried creating a new app with the same result. Google is baffled, too. We’re trying to integrate a different Ruby gem for Google login now. Will let you know how it goes!

Alright. Well, unfortunately, I don’t have any other idea or clue :’(

I’ll let you know if I/we can think of something else! Keep us posted.