Skip to content

Add CIMD support for automatic oauth app creation, and PKCE support#1978

Merged
coyotte508 merged 4 commits intomainfrom
oauth-cimd
Nov 21, 2025
Merged

Add CIMD support for automatic oauth app creation, and PKCE support#1978
coyotte508 merged 4 commits intomainfrom
oauth-cimd

Conversation

@coyotte508
Copy link
Copy Markdown
Member

@coyotte508 coyotte508 commented Nov 7, 2025

Add CIMD support, for automatic oauth app creation, and add PKCE support

Just need to set OPENID_CLIENT_ID=__CIMD__ or OPENID_CONFIG={CLIENT_ID:"__CIMD__",...}

By the way after this PR, no need for OPENID_CLIENT_SECRET, so open id config can be a public var and does not need to be secret (just remove the secret from it), cc @rtrompier

Internal ref: https://github.com/huggingface-internal/moon-landing/pull/15624

Tested on https://huggingface.co/spaces/coyotte508/chat-ui - first real use of CIMD cc @evalstate :)

Note

  • new cookie hfChat-codeVerifier (lasts 1 hour) during oauth process
  • we could probably have set the cookies' paths to /${base} instead of "/"... (too late to change it?)
Copy link
Copy Markdown
Member Author

@coyotte508 coyotte508 Nov 7, 2025

Choose a reason for hiding this comment

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

instead of forwarding url everywhere, we could use contextStore like here: https://github.com/huggingface/Mongoku/blob/2a6c715c5bf4a7f7351aa3b3ce90ecd857e61d70/src/hooks.server.ts#L17-L48

(not sure for compat with non-node runtimes)

could also be used for structued logs (eg request id, ...)

@coyotte508 coyotte508 marked this pull request as ready for review November 7, 2025 21:57
@coyotte508 coyotte508 changed the title Add CIMD support for automatic oauth app creation Add CIMD support for automatic oauth app creation, and PKCE support Nov 7, 2025
@coyotte508 coyotte508 merged commit cca007b into main Nov 21, 2025
4 of 6 checks passed
@coyotte508 coyotte508 deleted the oauth-cimd branch November 21, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants