-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
All the time
Description
We've recently upgraded from Stitch to Realm and authenticating to Google using the official docs.
Here's the relevant code:
useGoogleLogin({ onSuccess: credentialResponse => { const token = credentialResponse.access_token; const credentials = Realm.Credentials.google({ token }); app.logIn(credentials).then((user) => { console.log(`Logged in with id: ${user.id}`); }); }, onFailure: () => { // removed, as irrelevant }, });
Everything form Google is working fine; I receive the id_token, then I pass it along to Realm. That's when I get the error message.
I've also tried passing along the auth code, but Realm just stalls with nothing returned. If I pass along the access_token, I get the same error as before.
Stacktrace & log output
We get the following response after passing along the id_token from Google:
Failed to load resource: the server responded with a status of 401 ()
Our logs in MongoDB shows the following:
error fetching info from OAuth2 provider
Remote IP Address:
[IP address removed for security reasons]
Can you reproduce the bug?
Yes, always
Reproduction Steps
Install Realm-web:
npm i --save realm-web (version currently installed: 1.7.0)
Import it:
import * as Realm from "realm-web";
Implement the code found here
Retrieve the Google id_token (or auth code or access_token... doesn't seem to matter). Pass it along:
const credentials = Realm.Credentials.google({ idToken });
app.logIn(credentials).then((user) => {
console.log(`Logged in with id: ${user.id}`);
});
Results in the the same error response every single time: error fetching info from OAuth2 provider
If I switch on OpenID, it suddenly works, however, OpenID doesn't return the email, which is necessary for my use case, so that's not useful.
Version
1.7.0
What SDK flavour are you using?
Atlas App Services (auth, functions, etc.)
Are you using encryption?
Yes, using encryption
Platform OS and version(s)
Windows, Mac, Linux
Build environment
Which debugger for React Native: ..
Cocoapods version
No response