Code 47 error on realm.logIn(credentials) with Google oAuth

I’m trying to use realm.login.

  1. I’m using expo-auth-session/providers/google for getting the oAuth 2.0 access_code
  2. The Google oAuth response params have access_token, code, id_token, etc.
  3. I’m trying to use the access_token, id_token, or code for creating the credential for using realm.login()
  4. The error code is 47 and message is
    “error exchanging access code with OAuth2 provider” or “error fetching info from OAuth2 provider”.

const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: process.env.GOOGLE_EXPO_CLIENT_ID,
androidClientId: process.env.GOOGLE_ANDROID_CLIENT_ID,
iosClientId: process.env.GOOGLE_IOS_CLIENT_ID,
webClientId: process.env.GOOGLE_WEB_CLIENT_ID,

useEffect(async () => {
// try {
if (response?.type === “success”) {
const idToken = response.params.id_token;
const { access_token, code } = response.params;

  if (idToken) {
    const credentials ={
      // authCode: code,
      // idToken: access_token,

      .then((user) => {
        console.log(`Logged in with id: ${}`);
      .catch((err) => {
        console.log("@realm.login: err", err);

}, [response]);
With the above code, if I do console.log(credentials) it’s an empty object. Is it normal?

For Realm,

  1. I turned on Google for [Authentication Providers] and added client ID and secret from Google console for the web application credential for Realm.
  2. Open ID is off

and Google console.
I have the web application credential for Realm;
Authorized JavaScript origins:
Authorized Redirect URIs:
And 4 more credentials (Web application for Expo Go Proxy, Web application for web client, iOS, and Android)

And also have /auth/providers.json (I’m not sure it’s needed even I set it on the Realm UI page)
{ "oauth2-google": { "name": "oauth2-google", "type": "oauth2-google", "disabled": false, "config": { "clientId": process.env.GOOGLE_CLIENT_ID, "openId": false }, "secret_config": { "clientSecret": process.env.GOOGLE_CLIENT_SECRET }, "metadata_fields": ["name", "first_name", "last_name", "picture", "email" ], "redirect_uris": [], "domain_restrictions": [] } }

If I run this code with the access_token, I can receive the user data without any issue.
const getUserInfo = async (token) => { let userInfoResponse = await fetch( "", { headers: { Authorization:Bearer ${token}` },
).catch((err) => console.log(“@getUserInfo: err”, err));

  .then((data) => {
    console.log("@userInfoResponse > data:", data);
    const user = data;
  .catch((err) => console.log("@userInfoResponse: err", err));