I have a question regarding Auth0 v2 for iOS, how to renew the idToken?
I am using renew(withRefreshToken refreshToken: String, scope: String?) method with refreshToken, but it’s only returning new accessToken, and I need idToken. In v1 there was a method fetchNewIdTokenWithRefreshToken, but how to do this in v2?
I’ve managed to obtain new idToken using delegation, maybe it’ll be helpful for someone, so I’m posting it below:
Auth0
.authentication()
.delegation(withParameters: "refresh_token": refreshToken])
.start { result in
switch result {
case .success(let data):
guard let idToken = data"id_token"] as? String else {
// No id token
return
}
// Save your idToken
case .failure(let error):
print(error.localizedDescription)
}
}