Skip to content

fix(oauth2ac): don't signal spurious refresh on first authorization - #13

Merged
waynz0r merged 1 commit into
mainfrom
fix-oa2ac-reauth-bug
Jul 28, 2026
Merged

fix(oauth2ac): don't signal spurious refresh on first authorization#13
waynz0r merged 1 commit into
mainfrom
fix-oa2ac-reauth-bug

Conversation

@waynz0r

@waynz0r waynz0r commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Authorize checked syncGate.IsOpen() both before and after storeTokenAndAuthorize, but that call opens the gate as a side effect (via setAuthorizedStatus), so the post-check always read true — even on the very first authorization.
  • This caused signalRefresh() to fire spuriously on first-time auth, making tokenRefresherLoop immediately replace the token it just published and emit a bogus RemoveEventType credential event right after the initial Update.
  • Fix: capture syncGate.IsOpen() once before the token is stored, and use that captured value for both the early-return check and the post-store refresh-signal decision, so refresh is only signaled on genuine re-authorization.

@waynz0r
waynz0r force-pushed the fix-oa2ac-reauth-bug branch from b4cfbef to d0bed7d Compare July 27, 2026 18:14
@waynz0r
waynz0r merged commit a8380ca into main Jul 28, 2026
1 check passed
@waynz0r
waynz0r deleted the fix-oa2ac-reauth-bug branch July 28, 2026 12:57
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.

2 participants