canonry

Sign in with ChatGPT

An install can let invited people sign in to the dashboard with their ChatGPT account, and run their Aero answers on their own ChatGPT plan instead of the install’s provider key. The two are switched on separately:

Switch What it does What OpenAI must have approved
chatgpt.signIn “Continue with ChatGPT” on the sign-in screen, for invited email addresses A hosted OAuth client (identity scopes)
chatgpt.planUsage A signed-in viewer’s Aero runs on their ChatGPT plan once they connect it The same client with the plan scopes (resource.invoke, chatgpt.tokens.use.direct)
chatgpt.requirePlan Viewers must connect their plan to use Aero; the install’s key never pays for viewer Aero Same as planUsage

Both are off unless configured. Name and password sign-in, API keys and the operator’s own Aero are unchanged.

Before you start

Configure

In config.yaml:

publicUrl: https://dash.example.com
chatgpt:
  clientId: <client ID from OpenAI>
  clientSecret: <only for a confidential client>
  signIn: true
  planUsage: true
  requirePlan: true   # optional: no viewer Aero without the viewer's own plan
  tokenKey: <64 hex characters: openssl rand -hex 32>

Invite people

Sign in with ChatGPT admits only invited email addresses and accounts that already linked ChatGPT.

cnry user invite jordan@example.com --role viewer
cnry user invitations
cnry user uninvite <invitation-id>

Nothing is emailed. Tell the person to open the dashboard and choose Continue with ChatGPT with the ChatGPT account that uses that address. If ChatGPT reports the address as verified, their account is created with the invited role and their ChatGPT identity is linked to it. From then on the identity, not the email, signs them in.

API: GET|POST /api/v1/users/invitations, DELETE /api/v1/users/invitations/{id} (administrators or a full-instance key, users.read / users.write).

What people see

The button uses OpenAI’s black and white formats through the dashboard’s primary button. OpenAI’s guidelines also call for their logo on it: add the official asset from OpenAI before a public launch.

Aero on a person’s plan

With planUsage on, signing in with ChatGPT also asks the person to let the dashboard use their plan. Once granted:

When the plan cannot answer, the person sees one of: connect again, usage limit reached (with a link to https://chatgpt.com/settings/usage), plan not eligible, or ChatGPT unavailable. A plan that needs connecting again is refused, not charged to the install. A viewer with no plan connected uses the install’s Aero as before, unless requirePlan is on: then Aero asks them to connect their plan first (409, reason chatgpt-connect-required), and GET /api/v1/auth/chatgpt/status reports planRequired: true so the dashboard can offer the connect step up front.

POST /api/v1/auth/chatgpt/disconnect deletes the stored grant, then revokes it at OpenAI; revoked: false means OpenAI did not confirm, and the person can also remove the app in ChatGPT settings. The ChatGPT link stays, so they can still sign in with it.

How it is protected

Troubleshooting

The sign-in screen reports chatgpt_error codes after a failed callback:

Code Meaning
not-invited No linked identity and no pending invitation for that verified email
unverified-email ChatGPT has not verified the account’s email
already-linked That ChatGPT account is linked to another account here
expired Took longer than ten minutes, opened in another browser, or replayed
denied The person cancelled at OpenAI
disabled Sign-in is off, or the block is incomplete
failed OpenAI refused the code, or the ID token did not verify

GET /api/v1/auth/chatgpt/status shows what the install offers and the signed-in person’s link and plan.