Sign-in using google

Could someone share a working example of sign-in using Google ?
I am getting a Redirect URI mismatch error after following the instructions here:
https://developers.google.com/identity/sign-in/web/devconsole-project

When I put in the exact webpage address (i.e. bubble.is/site/xyz/…) in redirect URI field instead of leaving it blank, the login works smoothly.
However, I am unable to get the user to sign in whenever the origin page has any URL parameters (i.e. bubble.is/site/xyz/…?tag=abc). It appears google signin needs exact address (from which the login was initiated) in redirect URI field

Any solution for this ?

1 Like

Not really, Google is very strict with that, so you should find a way not to have to pass some info with the URL.

2 Likes

I’m having this same problem.
I’ve enabled the Google Plugin, and entered both my App Secret and App ID/API Key from the Google Developer Console API Credentials page.

I’ve tried authenticating two ways:

  1. Creating a button, whose workflow is set to Sign In using the Google Oauth provider

But, on-click of the button, I get this:

  1. I’ve also created a HTML element, with Google-provided code, from here

On a mobile browser (iOS Safari), the return is “Logged In”, but on desktop, it just opens the auth window, then closes it.

Here’s my example site. The Google-provided login button is at the top, on the left, and the one that uses Bubble.is oauth workflow is on the right (“Sign In”)

https://bubble.io/site/gmcwsa16auc/version-test/index?debug_mode=true

Please make sure the URLs match EXACTLY, as Google is very strict on this. Meaning, for instance, that in debug mode, since it’s in the URL, you should register this one as well with Google. Since you can have as many as you want it’s not an issue.

The best is to copy paste the URLs when an error is happening.

Thanks for the reply @emmanuel.

I’ve regenerated the app secret, and the issue still persists (with both Sign-in buttons). I’ve tried to put the full web app URI in to Google oauth, but this is the message google gives:

Can someone give a screenshot of a working Google Sign in oauth config, and Bubble.is button code?

Thanks,

Rob

UPDATE/RESOLVED: Adding the Authorized redirect URI of my app now results in successful authorization, via the Bubble.is Google Sign in API:

1 Like

Yes, it has to be EXACTLY the same URL.

@emmanuel how would you do for pages that have types and consequently id within their url? Thanks.

I think google won’t let you do this.

1 Like

what about for example profile pages where the users username is part of the url (as a path or parameter)?
Lets say I am looking at somebodys profil page (“www.mydomain.com/profiles/Joe”) and decide to login with my google account.

What would be a good way to workaround this problem? My only (not so good) ideas was to have the login button as a redirect to the index whenever someody hits Login on a profile page.

1 Like

Hey @pat did you ever figure out how to solve this? I’m trying to do the same thing and can’t find a good way to do it other than having Google open up the OAuth as a new window. This seems complex technologically.

Did you manage to solve this?

Edit: for now a workarround seems to have a page just for signin/signup, and to register its url in the google api console.
In this page, you can set a workflow that when the page is loaded, signup/login the user with google.

Then, if you want to login from a popup, you add a link element that open this page in a new tab.

The only thing I am missing is to find a way to close this tab once the user is logged in.
Is there any way to close an opened tab?

Edit 2: to close the opened tab once the user is logged in, just add an html element with a custom state “content” as text. Then in the html element, set the content to
Finally in the workflow, run a workflow when the user is logged in that change the html content to “window.close();”

Now I am able to login/signup to Google+ from any page of my website and without leaving it :slight_smile:

2 Likes

Been stuck on this too. After much trial and error, it worked this way for me:

52
Some may be useless, but it works :slight_smile:
They key was to add _https://appname.bubbleapps.io/version-test_ in the Authorized redirect URIs for me.
No need to create intermediary pages, workflows or else.

Hope this can help others!

2 Likes

This is a huge pain. And Facebook is going to disallow dynamic redirect URIs in ~60 days. So Facebook login will become equally painful.

I’ve created a feature request for this: Issues with redirect URI - Google and Facebook login – please upvote if this will help you.

1 Like

Guys, I can sign in using Google, but I am not sure how to fill in the User database with the gmail address I have just signed in with. When I sign in, the email text-group / field is not changed. Only the user UID is changed…

Ok, solved :slight_smile: I was using Gmail Auth as opposed to Google Auth. Gmail Auth plugin is used for email sending authentication, not for signing up/logging in. Take care guys :slight_smile:

Thank you mate. I have tried your workaround, it worked well. I just added another https://www.appname.bubbleapps.io, and I can login from Google.

If this helps anyone (I stumbled across looking for help) this was my work around:
I’m dealing with companies that users are assigned to. So I have a data type “Company” that is stand-alone, and a place-holder for each user called “Assigned Company” that the stand-alone Company data-type links to.
When a user clicks “Login with X” on my site, it redirects them to a page with no data type. Then, for a workflow, I added a “When Page Loads” that triggers the login service. After they’re logged in, I have the workflow redirect them to the “Assigned Company” landing page.
If anyone needs more help feel free to reach out to me!

1 Like

Does this plugin work with Users who already exist in the Bubble database? I have a User foo@bar.com, and we’re able to get through the Google OAuth flow, but then the general Bubble alert This email is already in use: foo@bar.com pops up.

For reference, it works perfectly if the User didn’t exist already, as well as on subsequent attempts.

@emmanuel
I’m struglling with this from soo long. But i haven’t figured it out yet.
I want the simplest way to get the idtoken from google.

Is it possible to get the idtoken in return with this plugin?

1 Like