diff --git a/platform/shell-sync/sync.sh b/platform/shell-sync/sync.sh index 6d3ab803..86ef43de 100644 --- a/platform/shell-sync/sync.sh +++ b/platform/shell-sync/sync.sh @@ -42,3 +42,14 @@ oauth_authorization_invalid() { 'invalid_grant|expired.*(token|credential)|token.*expired|refresh token.*(expired|revoked|invalid)|authorization.*(expired|revoked)|AADSTS700082|AADSTS700084|AUTHENTICATE failed|authentication.*failed|authentication unsuccessful|invalid credentials' } +log_oauth_authorization_guidance() { + local i="$1" + local provider="$2" + local logfile="$3" + + if oauth_authorization_invalid "$logfile"; then + log "Account $i: OAuth2 authorization is expired, revoked, or rejected by $provider. Reauthorize with: docker compose run --rm imapsync authorize $i" + log "Account $i: After reauthorization, run immediately with: docker compose exec imapsync sync.sh sync $i" + fi +} +