Skip to content

fix: downgrade expected token exchange failure logs from error to info#305

Merged
heyitsaamir merged 3 commits intomainfrom
fix/token-exchange-log-level
Mar 6, 2026
Merged

fix: downgrade expected token exchange failure logs from error to info#305
heyitsaamir merged 3 commits intomainfrom
fix/token-exchange-log-level

Conversation

@heyitsaamir
Copy link
Collaborator

@heyitsaamir heyitsaamir commented Mar 6, 2026

Summary

  • Downgraded log level for expected SSO token exchange failures (400/404/412) from ERROR+WARNING to INFO
  • These status codes are part of the normal sign-in flow — they trigger the permission picker UI on the client
  • Unexpected HTTP errors still log at ERROR level and emit error events

Test plan

  • Trigger SSO sign-in flow and verify token exchange failure logs at INFO level instead of ERROR
  • Verify unexpected HTTP errors (e.g., 500) still log at ERROR level

🤖 Generated with Claude Code

The SSO token exchange returns 400/404/412 as part of the normal
sign-in flow to trigger the permission picker UI. These expected
failures were logged at ERROR level, creating noise. Now only
unexpected HTTP errors log at ERROR; expected failures log at INFO.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 6, 2026 19:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts OAuth SSO token-exchange logging in the Teams apps SDK to reduce noise for expected “permission picker” flows while preserving error reporting for unexpected failures.

Changes:

  • Downgrades logging for expected SSO token exchange failures (HTTP 400/404/412) from WARNING to INFO.
  • Keeps ERROR logging + error event emission for unexpected HTTP status errors during token exchange.

You can also share your feedback on Copilot code review. Take the survey.

heyitsaamir and others added 2 commits March 6, 2026 11:31
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address PR review comments:
- Use `log` variable instead of `ctx.logger` for consistency
- Keep error-level logging + error event for non-HTTPStatusError exceptions
- Only downgrade to info for expected HTTP 400/404/412

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@heyitsaamir heyitsaamir merged commit b5072e2 into main Mar 6, 2026
7 checks passed
@heyitsaamir heyitsaamir deleted the fix/token-exchange-log-level branch March 6, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants