Search code examples
iosxcodefirebaseoauth-2.0gidsignin

Swift iOS GIDSignIn scopes are not auto selected


iOS app using GIDSignIn for o-Authentication.

We are wondering why when the scopes are presented and not auto selected

enter image description here

Our Client ID and app is verified in our google console and we do NOT show an unsafe app upon sign in.

Does this change when the app is live in the app store? We do not understand why we have to select the scope ourselves when in

func signInWithGoogle() {
        guard let clientID = FirebaseApp.app()?.options.clientID else { return }

        // Create Google Sign In configuration object.
        let config = GIDConfiguration(clientID: clientID)
        
        print("Client ID: \(clientID)")
        let additionalScopes = ["https://www.googleapis.com/auth/youtube.readonly", "https://www.googleapis.com/auth/yt-analytics.readonly"]
        
       
        // Start the sign in flow! GIDSignIn
        GIDSignIn.sharedInstance.signIn(with: config, presenting: self, hint: nil, additionalScopes: additionalScopes) { [unowned self] user, error in
        

          if let error = error {
            // ...
            return
          }

}

GIDGoogleSignIn Framework Reference


Solution

  • "This is the intended behavior. We require the user to provide explicit consent for each scope being requested in addition to basic profile.

    Note that you can check which scopes the user grants after a successful sign-in and, at an appropriate moment, re-request the additional scopes via

    addScopes

    if needed."

    GoogleSignIn-iOS Github Source