TF-1974 Check refreshToken is not empty when calling appAuth.token()
(cherry picked from commit 4d06516a91d0c8c9ecf66275abe5f825309c4bba)
This commit is contained in:
@@ -72,7 +72,8 @@ class DownloadAttachmentsInteractor {
|
||||
}
|
||||
} catch (exception) {
|
||||
log('DownloadAttachmentsInteractor::execute(): $exception');
|
||||
if (exception is DownloadAttachmentHasTokenExpiredException) {
|
||||
if (exception is DownloadAttachmentHasTokenExpiredException &&
|
||||
exception.refreshToken.isNotEmpty) {
|
||||
yield* _retryDownloadAttachments(
|
||||
accountId,
|
||||
baseDownloadUrl,
|
||||
|
||||
@@ -79,6 +79,7 @@ class AuthorizationInterceptors extends InterceptorsWrapper {
|
||||
log('AuthorizationInterceptors::onError(): $err');
|
||||
if (_isTokenExpired() &&
|
||||
err.response?.statusCode == 401 &&
|
||||
_isRefreshTokenNotEmpty() &&
|
||||
_isAuthenticationOidcValid()) {
|
||||
try {
|
||||
final newToken = await _authenticationClient.refreshingTokensOIDC(
|
||||
@@ -139,6 +140,8 @@ class AuthorizationInterceptors extends InterceptorsWrapper {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool _isRefreshTokenNotEmpty() => _token != null && _token!.refreshToken.isNotEmpty;
|
||||
|
||||
String _getAuthorizationAsBasicHeader(String? authorization) => 'Basic $authorization';
|
||||
|
||||
String _getTokenAsBearerHeader(String token) => 'Bearer $token';
|
||||
|
||||
Reference in New Issue
Block a user