Error fetching info from OAuth2 provider (realm-web)

We’ve recently upgraded from Stitch to Realm and are authenticating to Google using the official documentation guide. I receive the id_token from Google and pass it along to MongoDB using this code:

const credentials ={ idToken });
app.logIn(credentials).then((user) => {
   console.log(`Logged in with id: ${}`);

That’s when I receive a 401 error, with this message in the logs: error fetching info from OAuth2 provider

If I switch on OpenID in Realm, suddenly it works, however that’s not helpful for my situation, as I need to retrieve the user’s email address.

I’m on version 1.7.0. I’m using this official package.

Hi I’ve run in the same problem and it’s funny how bad the documentation is… Never had a problem implementing auth in firebase , supabase ecc… with expo and also with react native it self. But now I’m stuck with this problem. Have you fixed it in the end ? Hopefully i can make it work, realm seems nice from the outside but get lost in this stuff that should be at the base of an app.

@Vasile_Andrei_Calin I submitted a bug report on Github. this bug is currently on their to-do list, though not priority, because there is a workaround: it requires switching to logging in with the MongoDB JWT function, instead of the Google function. Here’s the solution from one of the developers. It’s been working fine for us and for someone logging in with their Google account, they’ll notice no difference.

1 Like

This issue has been around the last two years, you have to work around and use JWT. The same with the Apple Login, and Facebook Login. Overall it’s never worked.

You got to also use JWT 8.0 you can’t use the new JWT 9.0 FYI.

Nora beat me to it, didn’t see that. But they are correct.