Credentials not saving on iOS 13 simulator

I am using Lock 2.0 with the iOS 13 simulator and saving credentials. It appears the credentials can’t be read or received. I haven’t tried this on device yet. I have the following code.

Lock
.classic()
.withOptions { options in
options.scope = “openid idToken profile offline_access”
options.audience = “https://test-brighloom-cantina.auth0.com/userinfo
options.oidcConformant = true
options.logHttpRequest = true
options.logLevel = .all
}
.onAuth { [weak self] credentials in
guard let self = self else {
return
}

            if !self.credentialsManager.store(credentials: credentials) {
                handler(Swift.Result<Void, AuthenticationServiceError>.failure(.failedToSaveToken))
                return
            }

            handler(Swift.Result<Void, AuthenticationServiceError>.success(()))
        }
        .onError { error in
            handler(Swift.Result<Void, AuthenticationServiceError>.failure(.failedToGetToken))
        }
        .present(from: windowScene.windows[0].rootViewController!)

But if I quit my app and restart the call credentialsManager.hasValid() it always returns false. The query always returns nil when getting the string but there is no error. So anytime we check to see if we have valid credentials on startup we are shown the login dialog.

Your sample app doesn’t appear to be working on the device as well.

3 Likes

We’re having the same issue, only in the Simulator. Works as expected on device.

  1. When user signs up, we do: credentialsManager.store(credentials: credentials) and it returns true. It’s supposed to have stored the credentials successfully in the keychain.

  2. With our authenticated user, we bring our user to the Feed, where we perform a session check to make sure credentials are valid/not expired. At this point, credentials cannot be found! Returned error is noCredentials.

Testing on:
Xcode 11.4 Beta 3
iPhone 11 (13.4) Simulator
Auth0 (1.22.1)
Lock (2.16.1)

Any remarks on this? Has it been reproduced?

Thanks