Google OAuth2 URI w/ referral parameter URL

Hi guys,

I am using AirDev Canvas template for my site (not sure if that is relevant) & implemented a referral signup workflow based on a &r=referral_code URL parameter. The referral works great with email sign-up.
I am now trying to implement social logins . I started with Google OAuth 2.0 which works well for signing-up without a referral parameter.
However, when trying to sign-up with Google from a URL that contains the &r=referral_code URL parameter, Google returns the “Error 400 : redirect_uri_mismatch”
I understand it is not possible to pass any dynamic parameter to the OAuth2.0 as the uri is static & cannot contain relative position, or wildcards *.

So the questions would be:

  • How can I setup my Google signup workflow so that bubble “remembers” the referral key contained in the URL parameter &r= and updates the user thing after Google created it?

  • How to “remove” the &r= URL parameter from the URL passed to Google so that I do not end-up with “Error 400 : redirect_uri_mismatch” if the user decides to sign-up with Google after following a referral link

I’m a total noob & it is my first project on which I spent only a few days, please explain as if I was a 6 years old & do not hesitate to include pictures.

OK, so quick update I managed to solve the issue after writing it down in the previous post but it is SUPER slow. This is what I did:

When “Google button (sign up) is clicked”
> Make changes to current user [User’s referral code = get r from page URL]
> Go to page login [Do not pass any parameter]
> Signup/login with Google

Do you guys know if there is a more efficient approach?

Anyone looking to do this in future, one way is to run a workflow setting a state on the page and then removing the URL parameter, i.e. before signup.