MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
269 stars 238 forks source link

iOS endsession not returning answer #433

Open itaishalom opened 1 year ago

itaishalom commented 1 year ago

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 :(

ItzikAlkotzerAidoc commented 1 year ago

I noticed it as well, any solution?

MaikuB commented 1 year ago

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