refreshIDToken method

Future<void> refreshIDToken()

Implementation

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

  final tokenRequest = OIDCTokenRequest(
    grantType: "urn:authgear:params:oauth:grant-type:id-token",
    clientID: clientID,
    accessToken: accessToken,
  );

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