handleOAuth401Error function

Future<bool> handleOAuth401Error(
  1. String failedAccessToken
)

Handle a 401 OAuth error.

Implementation

Future<bool> handleOAuth401Error(String failedAccessToken) async {
  clearOAuthTokenCache();
  final currentTokens = await getNeomageAIOAuthTokensAsync();
  if (currentTokens?.refreshToken == null) return false;
  if (currentTokens!.accessToken != failedAccessToken) return true;
  return checkAndRefreshOAuthTokenIfNeeded(force: true);
}