Google.logInAsync Safari problem

Hello all!
I’ve got a problem while trying to use the Expo.Google.logInAsync function.
When the function executes, the app opens Safari but, I get the Safari error: “Safari cannot open the page because it could not establish a secure connection to the server”.

I’m using the expo IOS simulator and this is my code:

  async loginWithGoogle() {
    this.setState({loading: 'google'})
    try {
      const result = await Expo.Google.logInAsync({
        androidClientId: credentials.androidClientId,
        iosClientId: credentials.iosClientId,
        scopes: ['profile', 'email']
      })

      if (result.type === 'success') {
        await loginWithGoogle({accessToken: result.accessToken}, this.props.client)
      }
    } catch (error) {
      const errorMessage = error.message.replace('GraphQL error: ', '')
      Alert.alert('Login error', errorMessage)
    }
    this.setState({loading: null})
  }

hi @jjgumucio, if you are using the ios simulator, you may need to put in additional ids (ie) iosStandaloneAppClientId and webClientId.

See:
https://github.com/expo/expo/issues/715
https://docs.expo.io/versions/latest/sdk/google.html

Thanks @quinlanj! I’ll check it out and comment afterwards.

I just added the iosStandaloneAppClientId and the webClientId and didn’t solve the problem.

I think my problem is different from the one you mention because I never get the google response. Safari opens up and shows the mentioned error (connection not secure) so I never get to authorize the app.

I’m really stuck here…

Any pointers would be very appreciated.

Also, I have discovered that Safari, while opening the browser to authorize the app, is taking an old iOS client id. I don’t know why or where is it taking it from. My code is using the new one. I read docs and it says that the web interface uses your device stored data so, should I clean up my PCs Safari cache and stuff?

Regards

Also, I have made a post request using the correct clientId using the python requests library and the request was successful and I got the authorization page as a result.

How do I make Expo to “forget” the old client Id? Do I have to rebuild the project?

@jjgumucio if you’re using iosStandaloneAppClientId, you’ll have to re run exp build when you change that value.

Yes, I’m uploading the new IPA to the App Store to test it.

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