MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
271 stars 244 forks source link

Forgot password on Azure user flow causes page to dismiss #251

Closed JKornberg closed 2 years ago

JKornberg commented 2 years ago

I'm using an Azure User Flow to authenticate users My request is as follows:

AuthorizationTokenRequest req = AuthorizationTokenRequest(
          _clientId, Platform.isIOS ? _redirectUrlIOS : _redirectUrlAndroid,
          discoveryUrl: _discoveryUrl,
          scopes: _scopes,
          promptValues: ["login"],
          serviceConfiguration:
              AuthorizationServiceConfiguration(_authorizationUrl, _tokenUrl));
      try {
        result = await _appauth.authorizeAndExchangeCode(req);
        return result;
      } catch (e) {
        print(e.toString());
        return null;
      }

When the browser page pops up, if the user selects "forgot password", an error is thrown and the browser dismisses. This is happening on Android. Any advice would be much appreciated

TomGobillard commented 2 years ago

https://docs.microsoft.com/en-us/azure/active-directory-b2c/add-password-reset-policy?pivots=b2c-user-flow#self-service-password-reset-recommended

You have to check if the error returns is a AADB2C90118 error (caused by wrong policy) to call again the endpoint with the righ policy such as B2C_1_pwd_reset