14.9 C
London
Saturday, May 18, 2024

swift – Fb Restricted Login on iOS does not work for manufacturing customers


Firstly, it has been some time since I’ve printed a Fb app to help Fb Login and I am undecided whether or not the standing Printed is identical as Reside, can anybody verify that?

I just lately up to date Fb Login to Fb Restricted Login (Fb SDK v.17.0.1). Previous to this replace, the basic Fb Login was working fantastic in dev mode.

My challenge is that I can not login, as a result of I both do not obtain a AuthenticationToken or that I obtain a standing cancelled (I am testing on iOS 17.4.1).

The move is as follows:

I am making a LoginConfiguration occasion with a SHA256 nonce as under:

let rawNonce = String.randomNonceString()
let sha256Nonce = rawNonce.sha256
let config = LoginConfiguration(permissions: ["public_profile", "email"], monitoring: .enabled, nonce: sha256Nonce)!

As soon as I’ve the config I am utilizing it to login, and I am accessing the token from the AuthenticationToken.present as per the Restricted Login docs right here.

let loginManager = FacebookLogin.LoginManager()
loginManager.logIn(viewController: viewController, configuration: configuration) { lead to
    swap end result {
        case .success(let grantedPermissions, let declinedPermissions, let token):
            let authTokenString = AuthenticationToken.present?.tokenString
            // Create OAuth credential for Firebase Auth utilizing the authTokenString and rawNonce

        case .cancelled:
            // Consumer cancelled login

        case .failed(let error):
            print(error)
    }
}

I’ve recognized the next points:

  1. With a person that has an App Position within the Fb app, all the pieces works nice.
  2. With a manufacturing person that does not have an App Position within the Fb app, the login fails with 2 completely different situations:

State of affairs A:
If I move monitoring .enabled on the LoginConfiguration occasion then the login operate returns end result .success, however the AuthenticationToken.present is nil.

State of affairs B:
If I move monitoring .restricted on the LoginConfiguration occasion then the login operate returns end result .cancelled which is senseless.

Different issues I attempted:

  • I’ve tried enabling App Monitoring Transparency previous to logging in, however the above behaviour remained the identical.
  • In accordance with Fb’s Restricted Login docs I perceive that I should not be utilizing the AccessToken returned within the login’s callback anymore, and I ought to use the worldwide AuthenticationToken (and in addition the Profile to straight obtain person’s title, electronic mail, and so forth). Nonetheless, I’ve tried creating the Firebase Auth credential with the AccessToken that is returned within the login’s callback, however Firebase Auth sign up failed with the error Dangerous entry token.
  • I attempted accessing the AuthenticationToken each 0.5 sec till it isn’t nil, however this did not work both.
  • I attempted on each the Simulator and an actual system.
Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here