expo-google-app-auth:When OAuth login, got an error redirect_uri_mismatch

Published on:
Last updated:

This post is also available in: 日本語 (Japanese)

I implemented OAuth2.0 authentication(login with Google account) with expo-google-app-auth, and when I tried to log in, I got an error saying redirect_uri_mismatch, so I make a note.

So, as a result of search, when developing using expo, when debugging the development application with the expo application and trying to log in with a Google account, specify "host.exp.exponent" as the package name.Then, the error disappeared, and I was able to log in without any error.

Since the package name cannot be edited, it was supported by registering the development application separately on Firebase or Google Cloud Console.
- From Firebase, "Settings > General > Add App"
- From Google Cloud Console, "API and Services > Credentials > Create credentials > OAuth client ID"

When I registered the app with Firebase, I was able to confirm that the OAuth 2.0 client ID was automatically created on the Google Cloud Console screen in the same project.
At this time, by specifying "host.exp.exponent" in the package name and rewriting it to the corresponding google-services.json, OAuth2.0 authentication (login with Google account) works without problems.

No tags for this post.

About
Kuniyoshi Takemoto is the founder of Amelt.net LLC, and editor of this blog(www.amelt.net).Learn more and follow me on LinkedIn.