Skip to content

fix(oauth): always return newProps in tokenExchangeCallback + diagnostic log#197

Merged
liplus-lin-lay merged 1 commit into
mainfrom
196-oauth-tokenexchange-diag
Apr 20, 2026
Merged

fix(oauth): always return newProps in tokenExchangeCallback + diagnostic log#197
liplus-lin-lay merged 1 commit into
mainfrom
196-oauth-tokenexchange-diag

Conversation

@liplus-lin-lay
Copy link
Copy Markdown
Member

Closes #196
Refs #195 #187

tokenExchangeCallback を常に { newProps } 返却に変更し、runtime の grantType 実値を [oauth-diag] prefix で wrangler tail に捕捉可能にする。as never cast + 条件分岐で runtime で skip されてる疑いが #187 KV grant 消失と #195 callback/auth-loop 症状の上流仮説。deploy 後に tail log で 1 回再現分の grantType 実値を見てから根本対処を判断する diagnostic patch。

impact scope:

  • worker 側のみ、1 ファイル 1 関数内の変更
  • library 戻り値の shape は { newProps } で互換維持
  • client 側 (mcp-server / local-mcp) 変更なし

…allback

Remove the conditional that returned undefined for non-refresh_token grants
in `worker/src/oauth.ts#createOAuthProvider.tokenExchangeCallback`. Always
return `{ newProps }` so the library receives a grant-update signal for
every grantType. Replace the terse log line with an `[oauth-diag]` entry
that prints the JSON-stringified grantType and the keys of `ghProps` so
`wrangler tail` can reveal the real runtime grantType value.

refresh_token の runtime 値が library の typed union と一致せず条件分岐
が常に false で skip されていた疑いがあり、非 refresh 系の grant が
undefined 返却で library の grant-update signal を失って KV 側で grant
状態が消える一因になっていた可能性への対策。#187 で特定済みの KV grant
消失と #195 の callback/auth-loop 症状両方の上流で、診断 log で runtime
実値を捉えてから本 fix 判断する。

Refs #196 #195 #187
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
github-webhook-mcp 4b0bd0d Apr 20 2026, 03:36 AM

@liplus-lin-lay liplus-lin-lay merged commit 9b65780 into main Apr 20, 2026
3 checks passed
@liplus-lin-lay liplus-lin-lay deleted the 196-oauth-tokenexchange-diag branch April 20, 2026 03:37
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.

fix(oauth): always return newProps in tokenExchangeCallback + diagnostic log

1 participant