MaikuB / MaikuB/flutter_appauth

authorize_and_exchange_code_failed, Failed to authorize: [error: null, description: Invalid ID Token]

Open
#486 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
308
Forks
301
Avg merge
2d 11h
Merged PRs (30d)
5

Description

I need urgent help, I'm trying to make my app authenticate with Microsoft Login ID.

If I use it the way below, there is no error and it can get the authorization code, so I think the application configuration in Azure is correct.

final AuthorizationResponse? result = await appAuth.authorize(
AuthorizationRequest(_clientId, _redirectUrl,
discoveryUrl: _discoveryUrl, scopes: _scopes, loginHint: null),
);

But I need the email address that logged in, so I understand that I need to use the method below, but when I use it it returns this error: Exception has occurred.
PlatformException (PlatformException(authorize_and_exchange_code_failed, Failed to authorize: [error: null, description: Invalid ID Token], Issuer mismatch, null))

final AuthorizationTokenResponse? result1 =
await appAuth.authorizeAndExchangeCode(
AuthorizationTokenRequest(
_clientId,
_redirectUrl,
discoveryUrl: _discoveryUrl,
scopes: _scopes,
),
);

@MaikuB Can you help me please?

additional information

final String _discoveryUrl =
'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration';
final List _scopes = ['openid', 'profile', 'email'];

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the authorizeAndExchangeCode call in the reported Dart usage and compare it with the successful authorize call, using the supplied Microsoft discovery URL and scopes. Investigate the reported Invalid ID Token and issuer mismatch; done means the code exchange succeeds and the authenticated email is available, with the relevant configuration or usage documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter, ios
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.