AppAuth-iOS: Logout function not working on iOS > 14
Hello, I’m experiencing an issue on iOS > 14. The logout function “OIDEndSessionRequest” isn’t working correctly and I can’t complete the logout procedure.
This is my code:
let config = OIDServiceConfiguration(authorizationEndpoint: URL(string: AUTHORIZATION_ENDPOINT)!, tokenEndpoint: URL(string: TOKEN_ENDPOINT)!, issuer: URL(string: ISSUER)!, registrationEndpoint: URL(string: REGISTRATION_ENDPOINT)!, endSessionEndpoint: URL(string: END_SESSION_ENDPOINT)!)
let logoutRequest = OIDEndSessionRequest(configuration: config, idTokenHint: (authState?.lastTokenResponse?.refreshToken)!, postLogoutRedirectURL: URL(string: "REDIRECT_URI")!, state: (authState?.lastAuthorizationResponse.state)!, additionalParameters: nil)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "myView") as! MyViewController
let userAgent = OIDExternalUserAgentIOS(presenting: vc)
OIDAuthorizationService.present(logoutRequest, externalUserAgent: userAgent!, callback: { (authorizationState, error) in })
The error code received is: “Error Domain=org.openid.appauth.general Code=-3”
Can you help me please?
Thanks in advance
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16
We have a solution for our issue. We figured out that the OIDEndSessionRequest’s
idTokenHintparameter needs theidTokenand not arefreshToken.Indeed, but my main problem with this is, that this way the cookie will not be erased and upon the next login this will be seen by the user.