'Google OAuth on android/react native won't even initialize, unspecified problem with redirect_uri?

Recently I deployed an app to the internal testing track in the play store. I had to fix the app package name to do so - my mistake naming it poorly in development - and it may be responsible for breaking something, mysteriously, in the Google OAuth system.

The error that Google displays is useless... It tells me I violated a policy! But not which one. It just says something about the redirect_uri.

I've been staring at the message "You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure." for days now, tearing my hair out. Apparently almost nobody else has seen this message, and it's not documented.

screenshot

I had suspected I was using the wrong SHA1 certificate, but though it may have been incorrect, fixing it has not helped it.

Using the old (pre play store) package name in the cloud console works in dev, but not in production. Yes, I have a separate client id for the dev (signed with the default SHA1 for local dev) and a client id for the play store signed app... I'm pretty sure I've got it right now, though again, no details, I don't know. There's a reason I'm so obsessive about error codes and exceptions when I build software myself!

The only thing I've been able to do to change anything is by manually messing with the redirect_uri that expo-auth-session sends to Google, which sometimes causes a redirect_uri_mismatch... This indicates to me that the redirect_uri I'm using is a match? Meanwhile, redirect_uri_mismatch is a documented error code, but not redirect_uri.

What makes this more annoying is that apparently Google cloud OAuth config can take a long time to update, apparently up to a couple hours, but I have no idea when it's updated... So I can't tell if I'm testing against the propagated config changes? Huh??

I happen to believe that the lack of diagnostic info itself is a bug (how can you debug an opaque failure? An undocumented error?), But it seems like Google does not agree?

If it's helpful, I've been using Google OAuth for a year now for the web app part of this project... Never had this problem. I'm ready for launch. This is the only thing blocking. What am I to do?

There is a similar discussion about the Nest app, but that is attributable to the phase out of unsafe schemes: https://community.home-assistant.io/t/nest-authorization-error-error-400-invalid-request/399388



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source