Google Oauth 2.0 redirect_uri_mismatch for dynamic URIs

Hello there!

I’ve been using the Google plugin to authenticate users in my app through Google oauth 2.0.

On Google, I configured the main redirect_uri as <my_domain>/api/1.1/oauth_redirect and it works whenever my users try to log in from the homepage.

However, every time that a user goes to a specific generated page (a product listing page) they receive a redirect_uri_mismatch error.

Is there any solution or workaround for it?

Hey :slight_smile: Did you find any solution?

Hello there!
The solution for me was to create a fixed redirect page in between my app and google o auth.

in this way, the flow is as follows:

  1. my login page sends the request to my fixed redirect page with the callback url as a parameter;
  2. My fixed redirect page (inserted and authorized in Google as http://myapp.bubble.io/loginredirectpage) speaks with google, authenticate the user and get it back to bubble
1 Like

Hey,

I am currently facing this issue as well. Do you mind sharing a little more about this?

From my understanding, you redirect the page to your static redirect page (that are registered in Google console) when you click on the login workflow right? But how did you include the parameter in the URL when this parameter itself is dynamic and you can’t explicitly register this URL with the parameter in Google Console? Thanks.

hey @jeff.chia1995 can you be more specific with your use case ? What do you want to do ? redirect the user to a page where he was when he was trying to loggued in with Google?

If so, you can have a temp field on the user datatype to store a chunck of url (like url parameters) to get it him back to where he was.*

Hi Sarah,

But before even getting to that, I am not able to log the user in from any pages.
From my understanding from here ([New Feature] Using a generic redirect URL for OAuth providers - #12 by d.norkus) , as soon as you tick the box and put that URI into the google console, user should be able to sign in from any pages in the site, am I understanding this correctly?

image

I had put in all different combinations of the URI but I’m still getting error when signing user in. And in my workflow, this is all I do.

image

Thanks for taking your time to reply.

try to add also your root domain like 3rd one but without version-test/ (keep last slash)

the 3rd one is ok but you forgot the last slash

you can remove your 4th and 5th uri they are useless

here s my config

Cool! Its working now, thanks Sarah!
I think its just taking awhile for the Google console URI to kick in

1 Like

with pleasure @jeff.chia1995

But where do you store the callback (redirect) URL parameter, while the “login” page communicates with Google Authorisation?