refreshIDToken method

Future<void> refreshIDToken()

Implementation

Future<void> refreshIDToken() async {
  if (shouldRefreshAccessToken) {
    await refreshAccessToken();
  }

  final tokenRequest = OIDCTokenRequest(
    grantType: GrantType.idToken,
    clientID: clientID,
    accessToken: accessToken,
  );

  try {
    final tokenResponse = await _apiClient.sendTokenRequest(tokenRequest,
        includeAccessToken: true);
    final idToken = tokenResponse.idToken;
    if (idToken != null) {
      _idToken = idToken;
    }
  } catch (e) {
    _handleInvalidGrantException(e);
    rethrow;
  }
}