authorizationCodeFlow method

Future<void> authorizationCodeFlow(
  1. dynamic url
)

Implementation

Future<void> authorizationCodeFlow(url) async {
  String authCode = url.split("${Constants.authCode}=")[1];

  ClientAuthentication clientAuthentication =
      ClientAuthentication(pkcePair: pkcePairInstance);

  final AzureTokenResponse? tokensData =
      await clientAuthentication.getAllTokens(
    redirectUri: widget.redirectUrl,
    clientId: widget.clientId,
    authCode: authCode,
    providedScopes: (widget.scopes).isEmpty
        ? Constants.defaultScopes
        : createScopes(widget.scopes),
    userFlowName: widget.userFlowName,
    tenantBaseUrl: widget.tenantBaseUrl,
  );

  if (tokensData != null) {
    if (!mounted) return;
    // call redirect function
    handleTokenCallbacks(tokensData: tokensData);
    onRedirect(context);
  }
}