flutter_appauth icon indicating copy to clipboard operation
flutter_appauth copied to clipboard

iOS endsession not returning answer

Open itaishalom opened this issue 2 years ago • 2 comments

So on android it works perfect. On iOS - the pop up "domain name wants to sign you in" after conformation - the webview is open and closed but the code won't proceed. if the user press cancel on the pop up - an exception is called, which is fine. The logout by the way - is succeeded (I see on auth0 logs) but the code stuck (it awaits the result). This is code:

` Future<EndSessionResponse?> logout(String idToken) async {

String logoutUri = REDIRECT_URI;

final AuthorizationServiceConfiguration _serviceConfiguration = AuthorizationServiceConfiguration(

  authorizationEndpoint: this._issuer + 'authorize',

  tokenEndpoint: this._issuer + 'oauth/token',

  endSessionEndpoint: this._issuer + 'v2/logout?returnTo=$logoutUri',

);

return await _appAuth.endSession(EndSessionRequest(

    idTokenHint: idToken,

    discoveryUrl: this._discoveryURL,

    serviceConfiguration: _serviceConfiguration,

    issuer: this._issuer,

    preferEphemeralSession: false,

    postLogoutRedirectUrl: logoutUri));

}`

So no results from _appAuth.endSession(..) although no webview is present anymore. What to do?

Also, the cookies on Android are not deleted :(

itaishalom avatar Jun 14 '23 14:06 itaishalom

I noticed it as well, any solution?

ItzikAlkotzerAidoc avatar Jun 14 '23 15:06 ItzikAlkotzerAidoc

One thing I can pick up is It would look as though you hadn't configured the end session endpoint properly. The URL there has a returnTo query string that when I last checked was Auth0 defined their own spec. Since then they've followed the official spec where there's no such query string parameter. See https://auth0.com/docs/authenticate/login/logout/log-users-out-of-auth0. Other potential issue is allow not configuring the redirect URL properly. Whilst I've not tried it, I know Auth0 has separate configuration for the login and logout scenarios. Perhaps you haven't specified the logout one in their portal or if you have, the scheme doesn't match what you used that allowed logging in to work fine

MaikuB avatar Jun 16 '23 08:06 MaikuB