Search code examples
node.jsgoogle-app-engineexpressgoogle-apigoogle-oauth

redirect_uri_mismatch while using HTTPS:// on Google App Engine


Google signin works fine on my nodejs app via http (on Google App Engine).

But when tried via https - below error is received. Im using Google App Engine auto managed SSL.

The redirect URI in the request, http://www.example.com/api/auth/google/callback, does not match the ones authorized for the OAuth client.

The problem seems to be - my nodejs app in google app engine does not know the traffic is coming from https - I am using express - how to resolve this ?

Paths in google cloud console for oauth to use http and https are correctly set.


Solution

  • In Developer console you set up some Redirect URIs to use with your client credentials.

    You are currently trying to make a request and sending

    http://www.example.com/api/auth/google/callback

    As your redirect uri that is has not been added as a valid one. You either need to add as a valid one or better yet try sending from https://www.example.com/api/auth/google/callback instead

    My node.js knowledge is pretty basic but check your OAUTH2_CALLBACK