facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.74k stars 3.51k forks source link

Limited log in is failing with error: FBSDKErrorDeveloperMessageKey=Invalid ID token from login response. #2409

Open StefiGx opened 2 months ago

StefiGx commented 2 months ago

Checklist before submitting a bug report

Xcode version

15.2

Facebook iOS SDK version

17.0.0

Dependency Manager

CocoaPods

SDK Framework

Login

Goals

Figure out how to fix the issue of users not being able to log in using Facebook.

Expected results

Getting help on why the issue is happening and pointer how to fix it.

Actual results

I have updated our FBSDKLoginKit to the latest version (17.0.0) and followed all of the instructions in the documentation for implementing limited log in.

The problem I am experiencing is that when trying to call the login method I get this error message: FBSDKErrorDeveloperMessageKey=Invalid ID token from login response. I am using LoginConfigurations passing as permissions public_profile and email and tracking set to .limited as such:

let manager = LoginManager()        
let configuration = LoginConfiguration(permissions: ["public_profile", "email"], tracking: .limited)        
manager.logIn(viewController: viewController, configuration: configuration) { result in
      switch result {
      case .success:
        guard let authToken = AuthenticationToken.current?.tokenString else {
          callback(.failure(FacebookError()))
          return
        }
        callback(.success(authToken))

      case .cancelled:
        callback(.failure(FacebookError()))
      case let .failed(error):
        callback(.failure(error as NSError))
      }
    }

I get the same result even when using the previous login method but on the new version of the SDK:      

 let manager = LoginManager()
        manager.logIn(permissions: "public_profile", "email", from: viewController) { result, error in
          if let error = error {
            callback(.failure(error as NSError))
          } else if let result = result, !result.isCancelled {
            guard let authToken = AuthenticationToken.current?.tokenString else {
              callback(.failure(FacebookError()))
              return
            }

           callback(.success(authToken))
          } else {
             callback(.failure(FacebookError()))
          }
        }

I am getting this error even if I set the tracking to enabled and even if I accept ATT or not the behaviour is consistent.

tallior commented 1 month ago

Any updates on this?