GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — fix(core): register a new ChatGPT client when adding an account by rekram1-node · Pull Request #64945 · anomalyco/opencode Conversation
|
| ...(savedID ? {} : { agent_name_hint: agentName }), | ||
| ext_agent_host_id: hostID, | ||
| // Preselect this connection's account on reauthorization. | ||
| ...(profile ? { id_token_hint: profile.idToken } : {}), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
profile.idToken is only written at sign-in. Refreshes don't update it, so after logout this hint is usually long past its exp. OIDC says an OP should accept an expired id_token_hint, but some reject it with an error. If OpenAI does, sign-in after logout fails on every attempt and nothing falls back. Since this hasn't been tried live, please check it with a token older than an hour. If it's rejected, you could send only login_hint once the token has expired, or retry without the hints.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OpenAI's token-sharing guide covers this: "The hint may be expired; it identifies the account, not a valid authenticated session." So sending the saved ID token after logout is what they intend. Leaving it as is.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Agreed. If OpenAI's guide says an expired hint is accepted because it only identifies the account, then sending the ID token saved at sign-in is the intended use. My concern was based on the general OIDC spec, where an OP may reject an expired hint, and OpenAI's own guide answers it for this case. No change needed.
I haven't checked the guide's wording myself, and as the PR description says, this hasn't been tried live against OpenAI. A real sign-in after logout, with an ID token older than an hour, would confirm it. I made no edits in the checkout.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Correction to my earlier reply: the same sentence in the guide continues "Omit it after signing out or if none was retained." I dropped the saved profiles. The ID token now lives in the credential metadata and is only sent when reconnecting an expired connection, so logout deletes it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Agreed. The current head (46df5d6dc) matches the guide, and the concern from this thread doesn't apply anymore:
idToken and email are kept in the credential's metadata (credential(), chatgpt.ts:578–591). Removing the connection removes them too, so nothing stays behind after sign-out.authorize uses the active connection's metadata only when its client ID is in chatgpt-expired-clients (lines 135–138). In every other case it registers a new client and sends no hints (lines 617–625). After you sign out of everything, both hints are left out, which is what "Omit it after signing out or if none was retained" asks for.idToken forward without updating it (line 457), so the hint can be past its exp when reconnecting. That's the case where the guide says an expired hint is allowed.One thing does stay after sign-out: the client ID remains in chatgpt-expired-clients in plugin storage. It holds no token and identifies no account, and a successful sign-in with that client clears it (lines 214–217), so it doesn't conflict with the guide.
I checked this by reading the code only. I couldn't run the tests because the checkout fails to resolve @opencode/schema/money (workspace dependencies aren't installed). I didn't install them because the checkout is shared. I made no changes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The new commit only changes the tests: it makes the method-list mapping pass the type checker. bun test test/plugin/provider-chatgpt.test.ts still passes, 26 of 26. The public API is unchanged since my last review. The point about the saved id_token_hint going stale and never being refreshed is still open. Nothing new.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
50ec0ef to
80bc0bd
Compare
|
The Add account point is fixed in the latest commit. When a working ChatGPT account is already saved, "Sign in with ChatGPT" now registers a new client, so adding a second account no longer hits 3p_login_workspace_scope_denied. When only expired accounts (refresh got invalid_grant) or none are saved, it reuses the last account's client, so reconnecting doesn't add a duplicate. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
80bc0bd to
2b97632
Compare
2b97632 to
46df5d6
Compare
46df5d6 to
19725d6
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
openai: adding a second ChatGPT account fails with workspace scope denied
There was an error while loading. Please reload this page.