handleTokenCallbacks method

void handleTokenCallbacks({
  1. required AzureTokenResponse? tokensData,
})

Handles the callbacks for the received tokens.

Implementation

void handleTokenCallbacks({required AzureTokenResponse? tokensData}) {
  String? accessTokenValue = tokensData?.accessToken;
  String? idTokenValue = tokensData?.idToken;
  String? refreshTokenValue = tokensData?.refreshToken;

  if (accessTokenValue != null) {
    final Token token =
        Token(type: TokenType.accessToken, value: accessTokenValue);
    widget.onAccessToken(token);
    onAnyTokenRecivedCallback(token);
  }

  if (idTokenValue != null) {
    final token = Token(type: TokenType.idToken, value: idTokenValue);
    widget.onIDToken(token);
    onAnyTokenRecivedCallback(token);
  }

  if (refreshTokenValue != null) {
    final Token token = Token(
        type: TokenType.refreshToken,
        value: refreshTokenValue,
        expirationTime: tokensData?.refreshTokenExpireTime);
    widget.onRefreshToken(token);
    onAnyTokenRecivedCallback(token);
  }
}