How to handle url paramters with google Oauth


I’m using Google Oauth for a project, I used Canvas Api configured it and it works fine, but only when my page doesn’t have any parameters.

If I have parameters on my signin/login page, the Oauth procedure crash with the following error :
“Error 400 : redirect_uri_mismatch. You can’t connect to this app, because it doesn’t respect Google OAuth 2.0 policy. If you are the developper, save the redirection URI in Google Cloud Console.”

I tried converting my parameters into a json object store in the parameter “state” following this question : redirect - Google OAuth 2.0 redirect_uri with several parameters - Stack Overflow

But then I get this error : " Error 400 : invalid_request. Invalid redirect_uri contains reserved response param state", which I understand like the param “state” is reserved to google and can’t be used…

So here I’m stuck, any help would be much appreciated. Thanks ! :slight_smile:

Hello @user45

The following video provides a “deep” dive into making Google oAuth work. Perhaps it may help: :smiley:

Thanks a lot, I didn’t use the “generic redirect URL”, using it resolved the parameter issue !

1 Like