login method

Future<AuthSuccess> login(
  1. Session session, {
  2. required String code,
  3. required String codeVerifier,
  4. required String redirectUri,
  5. required bool isWebPlatform,
})

Validates a Microsoft authorization code and either logs in the associated user or creates a new user account if the Microsoft account ID is not yet known.

This method exchanges the authorization code for an access token using PKCE, then authenticates the user.

The isWebPlatform flag indicates whether the client is a web application. Microsoft requires the client secret only for confidential clients (web apps). Public clients (mobile, desktop) using PKCE must not include it. Pass true for web clients and false for native platforms.

If a new user is created an associated UserProfile is also created.

Implementation

Future<AuthSuccess> login(
  final Session session, {
  required final String code,
  required final String codeVerifier,
  required final String redirectUri,
  required final bool isWebPlatform,
}) async {
  return microsoftIdp.login(
    session,
    code: code,
    codeVerifier: codeVerifier,
    redirectUri: redirectUri,
    isWebPlatform: isWebPlatform,
  );
}