attemptToRefreshToken method

dynamic attemptToRefreshToken()

Implementation

attemptToRefreshToken() async {
  if (currentToken?.refreshToken != null) {
    AuthenticationApi authenticationApi = AuthenticationApi(authAPIClient);
    AccessTokenRequest accessTokenRequest = AccessTokenRequest();
    accessTokenRequest.clientSecret = APIConstants.clientSecret;
    accessTokenRequest.refreshToken = currentToken?.refreshToken;
    accessTokenRequest.grantType = "refresh_token";
    await authenticationApi
        .getAccessToken(accessTokenRequest)
        .then((tokenResponse) {
      updateClientsWithUserAccessToken(tokenResponse);
    });
  }
}