OAuth: Troubleshooting - What to do when things go wrong?
If you are having issues with logging into OAuth, here’s a checklist of things to look at:
- Unless you are on
localhost:8080, be sure you are using thehttpslink and not thehttplink. OAuth only works withhttponlocalhost, not on other platforms such as dokku. - If you are using
httpsand you are working with a dokku server (e.g.https://myapp.dokku-17.cs.ucsb.edu), check the Google Developer to make sure your callback urls have the correct address.- The callback url should start with
https - It should then have your app name, followed by the dokku hostname. Be sure you got the correct dokku number, and not
dokku-xxor something like that. - It should end in
/login/oauth2/code/googlefor Google OAuth (which is the common cases forjpaandteamtype assignments, and most of theprojseries assignments. - For
proj-organiconly, where Github OAuth is used, it should end in/login/oauth2/code/githubinstead.
- The callback url should start with
- Check that your have the
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETset correctly- For
localhost, check settings in.env - For dokku, check settings using dokku config show appname
- For
There is more detail below on a specific example of troubleshooting.
Troubleshooting Example
If you see this:

Try clicking the little arrow to open up the additional message:

Now, you’ll see the Redirect URI that the app is expecting.
If you go back to the Google Developer Console you can see what you really entered.
For example, when I was getting this error message, it’s because I put in this for my Redirect URI:

Rookie mistake! I literally had my-heroku-app instead of demo-spring-react-example.
Change it to the correct URI, click save. Then go back to the URL for the home page of your app and refresh the page (you don’t need to restart the application backend; just refresh your browser page.) Click login again, and you should get something like this:

Success!