msal-flutter icon indicating copy to clipboard operation
msal-flutter copied to clipboard

Authentication error when receive redirect from acquireToken

Open ductranit opened this issue 5 years ago • 5 comments

I tried to follow the document & an example in this plugin. User can sign in in b2c but it always in the redirect step with the exception Authentication error. My redirect url: msauth.com.my.package://auth I also set the CFBundleURLTypes & LSApplicationQueriesSchemes like the document & example, but still doesn't work. My code:

Future<String> acquireToken() async {
    if (pca == null) {
      pca = await PublicClientApplication.createPublicClientApplication(
          _clientId,
          authority: _authority);
    }
    try{
    await pca.logout();
    } on MsalException catch(e){
        LogUtil.e(e);
    }

    try {
      return await pca.acquireToken([
        "https://mytenant.onmicrosoft.com/b2capi/user_impersonation"
      ]);
    } on MsalUserCancelledException catch(e) {
      LogUtil.e(e);
    } on MsalNoAccountException catch(e){
      LogUtil.e(e);
    } on MsalInvalidConfigurationException catch(e){
      LogUtil.e(e);
    } on MsalInvalidScopeException catch(e){
      LogUtil.e(e);
    } on MsalChangedClientIdException catch(e){
      LogUtil.e(e);
    }on MsalUninitializedException catch(e){
      LogUtil.e(e);
    }on MsalInitializationException catch(e){
      LogUtil.e(e);
    } on MsalException catch(e){
      LogUtil.e(e);
    }
  }

Do you have any idea to debug the detail problem?

ductranit avatar Nov 28 '19 16:11 ductranit