AppAuth-iOS icon indicating copy to clipboard operation
AppAuth-iOS copied to clipboard

Not able to Logout in the App

Open victorynaveen opened this issue 3 years ago • 1 comments

guard let issuer = URL(string: Configurations.issuer) else { print("Error creating URL for : (Configurations.LogoutURL)") return }

    guard let tokenEndPoint =  URL(string: Configurations.tokenEndpoint) else { return  }
    
    //let endSessionUrl = issuer.appendingPathComponent("connect/endsession")
    guard let authorizationEndpoint =  URL(string: Configurations.authenticationEndpoint) else { return  }
    guard let endSessionEndPoint =  URL(string: Configurations.endSessionEndpoint) else { return  }
           
    //UIApplication.shared.open(endSessionEndPoint, options: nil, completionHandler: nil)
    guard let url1 = URL(string: Configurations.endSessionEndpoint) else { return }
  //  UIApplication.shared.open(url1)
    
           let config = OIDServiceConfiguration.init(authorizationEndpoint: endSessionEndPoint, tokenEndpoint: endSessionEndPoint, issuer: endSessionEndPoint, registrationEndpoint: nil, endSessionEndpoint: endSessionEndPoint)
           
    let keychainResponse = keychainManager.getAccessToken()
    
    let token = keychainResponse.message
 
        print("token \(token)")
    
    

    let url = URL(string: Configurations.AuthRedirectURL )!
           let endReq = OIDEndSessionRequest.init(configuration: config, idTokenHint: "access_token", postLogoutRedirectURL:url, additionalParameters: nil)
           
           
           let agent = OIDExternalUserAgentIOS(presenting: presenter)
           
    currentAuthorizationFlow = OIDAuthorizationService.present(endReq, externalUserAgent: agent!) { (response, error) in
        
        if let respon = response
        {
            print(respon)
        }

        if let err = error
        {
            print(err)
        }

}

I'm using above code for Logout but it is not working. I'm using App auth 1.4.0 version. x-code version 12.2. Please help me how to do Logout functionality.

victorynaveen avatar Mar 19 '21 19:03 victorynaveen

@victorynaveen did you solve this issue?

tiwari1amrit avatar Apr 18 '23 05:04 tiwari1amrit