.renew doesn't work properly

Versions to reproduce this bug:

pod 'Auth0', '~> 1.9.0'
pod 'Lock', '~> 2.4.0'

I’m having some troubles trying to get a new access token from a refresh token.
I’m using a native app with swift 4.

LoginController looks like

func checkAccessToken() {
        SessionManager.shared.refreshToken { error in
            DispatchQueue.main.async {
                guard error == nil else {
                    print("Failed to renew credentials: \(String(describing: error))")
                    return self.showLock()
                }
                SessionManager.shared.retrieveProfile { error in
                    DispatchQueue.main.async {
                        guard error == nil else {
                            print("Failed to retrieve profile: \(String(describing: error))")
                            return self.showLock()
                        }
                        self.performSegue(withIdentifier: "HomeView", sender: nil)
                    }
                }
            }
        }
    }

SessionManager looks like:

func refreshToken(_ callback: @escaping (Error?) -> ()) {
        guard let refreshToken = self.keychain.string(forKey: self.keyRefresh) else {
            return callback(SessionManagerError.noRefreshToken)
        }

        Auth0
            .authentication()
            .renew(withRefreshToken: refreshToken)
            .start { result in
                switch (result) {
                case .success(let credentials):
                    self.storeTokens(credentials.accessToken)
                    callback(nil)
                case .failure(let error):
                    self.logout()
                    callback(error)
                }
            }
    }

and retrieveProfile:

func retrieveProfile(_ callback: @escaping (Error?) -> ()) {
    guard let accessToken = self.keychain.string(forKey: self.keyAccessToken) else {
        return callback(SessionManagerError.noAccessToken)
    }

    Auth0
        .authentication()
        .userInfo(token: accessToken)
        .start { result in
            switch(result) {
            case .success(let profile):
                self.profile = profile
                callback(nil)
            case .failure(let error):
                callback(error)
            }
    }
}

The refreshToken returns true. So, in theory, access token is new.
Then I’m trying to retrieve profile again with the new access token and the result of RetrieveProfile is an error with:

Failed to retrieve profile: Optional({"sub":"****","email":"*****@gmail.com","email_verified":true})
Status Code is 0

Hey there @mggadaleta1,

As it has been more than a few months since this topic was opened and there has been no reply or further information provided from the community as to the existence of the issue we would like to check if you are still facing the described challenge?

We are more than happy to assist in any way! If the issue is still out there please let us know so we can create a new thread for better visibility, otherwise we’ll close this one in week’s time.

Thank you!

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.