简体   繁体   中英

Expo Google login working with Android simulator but not with iOS

I am making a simple Expo app where i am trying to implement the Google and Facebook login. I have implemented Facebook login, and tested on Both iOS and Android.

But with Google login i tried but its only working with Android Simulator. Its not working with iOS device and Simulator.

My Links are correct. But its giving me problem only with iOS simulator. This code is working with Android simulator and giving me google token on andorid device. But on iOS i am getting this error

"Your app is missing support for the following URL schemes com.googleusercontent.apps.ID-googleGivenID" was thrown while invoking loginAsync on target ExponentGoogle with params({ androidClientId = #ID-googleGivenID.apps.googleusercontent.com;
behaviour = system;
iosClientId = "#ID-googleGivenID.apps.googleusercontent.com";
scopes = (
  profile,
  email
)
})

App.json

{
  "expo": {
    "name": "InStore",
    "description": "This project is really great.",
    "slug": "InStore",
    "privacy": "public",
    "sdkVersion": "31.0.0",
    "platforms": ["ios", "android"],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true
    },
    "extra": {
      "googleAppId": {
        "ios": "#ID-googleGivenID.apps.googleusercontent.com",
        "android": "#ID-googleGivenID.apps.googleusercontent.com"
      }
    }
  }
}

Google Login File

const loginAsync = async () => {
  try {
    const result = await Google.logInAsync({
      androidClientId: '#ID-googleGivenID.apps.googleusercontent.com',
      iosClientId: '#ID-googleGivenID.apps.googleusercontent.com',
      scopes: ['profile', 'email']
    });

    if (result.type == 'success') {
      return Promise.resolve(result.accessToken);
    } else {
      return Promise.reject('Filed');
    }
  } catch (error) {
    return Promise.reject(error);
  }
};

fixed with

behavior : 'web' 
const result = await Expo.Google.logInAsync({ iosClientId: '-------------.apps.googleusercontent.com', androidClientId: '--------.apps.googleusercontent.com', behavior: 'web', scopes: ['profile', 'email'], });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM