Code Monkey home page Code Monkey logo

Comments (7)

vonovak avatar vonovak commented on June 19, 2024 2

Hello and thanks for reporting,
judging by the stack trace (mentions of unsupportedSchemes and relevantURLSchemes) I'm guessing that the error has to to do with checking the url schemes the app supports.

I was unable to reproduce this on my test project so without a runnable reproduction, I won't be able to assist further.

As for the config plugin iosUrlScheme parameter, please note that this parameter is only available to sponsors of the module, it's not part of the public package.

Finally, in the provided snippet

GoogleSignin.configure({
      scopes: [
        "https://www.googleapis.com/auth/userinfo.profile",
      ],
      webClientId: Platform.OS === 'android' ? <android_client_id> : <web_client_id>,
      iosClientId: Platform.OS === 'ios' ?  <ios_client_id> : undefined,
      offlineAccess: false,
    });

the webClientId parameter is wrong: it should always be the web client id, not the android_client_id.

I'm going to close this but feel free to provide a runnable repro so I can debug this.
Thank you 🙂

from google-signin.

codejudas avatar codejudas commented on June 19, 2024 1

@vonovak Your analysis of the stack trace helped me find the issue! I opened the project in Xcode and in the Info > Url Schemes section there was an empty url scheme for some reason, removing that fixed the crash.

With some trial and error I found that this section I had added to my app.json was causing the empty url schemes:

{
  "expo": {
    "ios": {
      ...,
      "infoPlist": {
        "CFBundleURLTypes": [
        {
           "CFBundleURLSchemes": "com.googleusercontent.apps.xxxxxxxxxxxxx"
         }
        ]
      }
    }
  }
}

Per [this documentation|https://docs.expo.dev/versions/latest/config/app/#infoplist] on the expo website, but probably I did something wrong. I think I had added this because I had googled some stuff about needing the url bundles in the info.plist and thought that would do it.. evidently not.

Anyways just putting this here in case some other unfortunate soul happens to stumble into the same set of circumstances. Thanks for your help!

from google-signin.

htcdang avatar htcdang commented on June 19, 2024

I observed the same behaviour in my expo app and solved it by providing the iosUrlScheme option to the config plugin. You can read more here.

from google-signin.

codejudas avatar codejudas commented on June 19, 2024

@htcdang I already have this in my app.json for a few days now of trying to get this working:

"plugins": [
       ....,
        "@react-native-google-signin/google-signin",
        {
          "iosUrlScheme": "com.googleusercontent.apps.xxxxxxxxx"
        }
      ],

from google-signin.

mohdabbas avatar mohdabbas commented on June 19, 2024

I am still facing the same issue! The app is getting crashed on iOS. On Android it is working fine. My app is managed by expo so I cannot use xcode. I am not using the sponsored version.

app.json

"plugins": [
"expo-apple-authentication",
[
"@react-native-google-signin/google-signin",
{
"iosUrlScheme": "com.googleusercontent.apps.xxx-xxx"
}
]
],
"ios:{
"bundleIdentifier": "myapp",
"infoPList": {
"CFBundleURLTypes": [{"CFBundleURLSchemes":["com.googleusercontent.apps.xxx-xxx"]}],
"UIRequiresFullScreen": true,
.....

GoogleLogin.js

const SignIn = async () => {
try {
GoogleSignin.configure({
webClientId: "xxx-xxx.apps.googleusercontent.com",
androidClientId: "xxx-xxx.googleusercontent.com",
iosClientId: "xxx-xxx.apps.googleusercontent.com",
})
// GoogleSignin.configure({
// scopes: [
// "https://www.googleapis.com/auth/userinfo.profile",
// ],
// webClientId: Platform.OS === 'android' ? 'xxx-xxx.apps.googleusercontent.com' : 'xxx-xxx.apps.googleusercontent.com',
// iosClientId: Platform.OS === 'ios' ? 'xxx-xxx.apps.googleusercontent.com' : undefined,
// offlineAccess: false,
// });
await GoogleSignin.hasPlayServices();
const userInfo = await GoogleSignin.signIn();

I am unable to get any userInfo, instead the app crashes. Unable to get any logs!

I am using:

"expo": "~49.0.6",
"react-native": "0.72.6",
"@react-native-google-signin/google-signin": "^11.0.0"

Thanks in advance for any suggestion/help.

from google-signin.

erickreutz avatar erickreutz commented on June 19, 2024

The problem is that the config plugin only works when using GoogleService-Info.plist. I've looked through the code and the config plugin uses expo/config-plugins IOSConfig.Google.withGoogle internally which does nothing with iosUrlScheme and so when you run expo prebuild it fails to add the scheme to the ios apps Info.plist.

That's why configuring it directly works. Which is what the expo docs suggest. i.e. You could also add it to ExpoConfig['scheme'] because it can be an array

{
  "ios": {
    ...
    "infoPlist": {
      "CFBundleURLTypes": [
        {
          "CFBundleURLSchemes": ["com.googleusercontent.apps.17898xxxxxx-xxxxxqhqj0exxxxxpl03xxx"]
        }
      ]
    }
  }
}

I'm further confused with this library because the docs reference versions 12 and 13 that do not exist in npm

image

from google-signin.

rajatpaymint avatar rajatpaymint commented on June 19, 2024

Is anyone able to solve this yet? I have followed the above steps and still have the same issue of app crashing on clicking 'Google Signin'. The crash occurs when executing Googlesignin.Singin(). Using iOS dev build.
I am using an expo-managed workflow.
This is my app.json
"googleServicesFile": "./GoogleService-Info.plist", "infoPlist": { "CFBundleURLTypes": [ { "CFBundleURLSchemes": ["com.googleusercontent.apps.-----"] } ],
Also tried this:
"plugins": [ [ "@react-native-google-signin/google-signin", { "iosUrlScheme": "com.googleusercontent.apps.--------" } ],
Have also tried adding directly to plist file:
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>com.googleusercontent.apps.-------</string> </array> </dict> </array>

from google-signin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.