refreshAccessToken method
Future<void>
refreshAccessToken(
)
Implementation
@override
Future<void> refreshAccessToken() async {
final refreshToken = _refreshToken;
if (refreshToken == null) {
await _clearSession(SessionStateChangeReason.noToken);
return;
}
final xDeviceInfo = await _getXDeviceInfo();
final tokenRequest = OIDCTokenRequest(
grantType: "refresh_token",
clientID: clientID,
refreshToken: refreshToken,
xDeviceInfo: xDeviceInfo,
);
try {
final tokenResponse = await _apiClient.sendTokenRequest(tokenRequest);
await _persistTokenResponse(
tokenResponse, SessionStateChangeReason.foundToken);
} on OAuthException catch (e) {
if (e.error == "invalid_grant") {
await _clearSession(SessionStateChangeReason.invalid);
return;
}
rethrow;
}
}