Google OAuth error "you must specify ClientId for GIDSignIn" in ejected IOS simulator

Okay, I know this issue has come up a ton so I’m just looking for a little direction since I’ve searched practically every thread and tried every solution to get this working. The app is created in create-react-native-app and uses a node.js backend and PGSQL server, not that any of that should matter… I have this function that is called on button press in my login component:

_GoogleSignInAsync = async () => {
        try {
            const result = await Expo.Google.logInAsync({
              iosClientId: "717150291405-59od49j7rliuqt96n3v2dcc4gbkfhh37.apps.googleusercontent.com",
              scopes: ['profile', 'email'],
            });
    
            if (result.type === 'success') {
              this.setState({
                  signedIn: true,
                  name: result.user.name,
                  photoURL: result.user.photoUrl
              });
            } else {
              console.log("cancelled");
            }
          } catch(e) {
            console.log("error",e);
          }
    }

which I copied from expo’s documentation. I then proceeded to “expo eject” my project because I saw that the error could be from expo not being able to connect to google’s API server in the first place. Which I predict might be true, because before I ejected the button would simply not do anything - now that it’s ejected and I’m running the simulator through XCode it throws an error:

Exception 'You must specify |clientID| for |GIDSignIn|' was thrown while invoking logInAsync on target ExponentGoogle with params (
behavior = system;
scopes = (
profile,
email
);
[etc..]

My app.json looks like:

{
  "expo": {
    "name": "nativesolemate",
    "description": "This project is really great.",
    "slug": "nativesolemate",
    "privacy": "public",
    "sdkVersion": "30.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,
      "bundleIdentifier": "SoleMateIOS",
      "publishBundlePath": "ios/nativesolemate/Supporting/shell-app.bundle",
      "publishManifestPath": "ios/nativesolemate/Supporting/shell-app-manifest.json"
    },
    "isDetached": true,
    "detach": {
      "iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.8.4-sdk30.0.0-3de13133-1adc-4ba1-8569-a84011e570b4.tar.gz",
      "androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.8.1-sdk30.0.0-271c32ab-0715-4dfb-8270-ecead3679bb4.tar.gz"
    },
    "scheme": "exp64ed007d25db40ae8496b69aa354ab61",
    "android": {
      "package": "solemate.android.me",
      "publishBundlePath": "android/app/src/main/assets/shell-app.bundle",
      "publishManifestPath": "android/app/src/main/assets/shell-app-manifest.json"
    }
  }
}

Here’s the real catch: on the google documentation for implementing this (Google Sign-In for iOS and macOS  |  Google Developers) it says to send your request in this way, keep in mind I don’t code in C, nor have I ever used CocoaPods:

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GIDSignIn sharedInstance].clientID = @"YOUR_CLIENT_ID";
  [GIDSignIn sharedInstance].delegate = self;

  return YES;
}

So the closest thing in my compiled IOS files, I find a document labeled EXGoogle.m in Pods folder. I found the code:

-(void)systemLogInWithIosClientId:(NSString *)clientId
                      webClientId:(NSString *)webClientId
                           scopes:(NSArray<NSString *> *)scopes
{
  [GIDSignIn sharedInstance].delegate = self;
  [GIDSignIn sharedInstance].uiDelegate = self;
  [GIDSignIn sharedInstance].clientID = @"717150291405-59od49j7rliuqt96n3v2dcc4gbkfhh37.apps.googleusercontent.com";
  if (webClientId != nil) {
    [GIDSignIn sharedInstance].serverClientID = webClientId;
  }
  [GIDSignIn sharedInstance].scopes = scopes;
  [GIDSignIn sharedInstance].shouldFetchBasicProfile = YES;
  [[GIDSignIn sharedInstance] signIn];
}

Which seemed like where I was supposed to insert the ClientID I got form google although in the snippet I posted I went ahead and added the literal clientID, and before it was:

[GIDSignIn sharedInstance].clientID = clientID

I think I’m doing this right, but clearly I’m missing some reference point, don’t have some package installed, didn’t eject properly, or something. I hate to make y’all troubleshoot this but can someone give me a little headway?

Thanks y’all

Mark this as fixed, it was actually a fault of something which I can’t figure out, but when I undid my eject, and tried running it in Expo simulator again, the login miraculously worked. Weird…

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.