Skip to content

Conversation

@rowansmithau
Copy link
Contributor

@rowansmithau rowansmithau commented Dec 1, 2025

Reported by ent customer on ticket 4688. related thread: https://codercom.slack.com/archives/C014JH42DBJ/p1763983935459739

This PR adds the oauth_id_token column to the user_links table and has Coder capture and store the id_token returned by Azure as part of the OIDC login process to the new column. This is needed because Azure provides both an access_token and id_token value in it's response to coderd, but the access token is a v1 token which has an audience and issuer which corresponds to microsoft graph, while the id token is issued against the customer tenant.

The reasoning behind this is the access token / v1 graph token is only able to be validated by microsoft, which means when other services within Coder make use of the Azure OIDC token, such as authenticating to Vault, this fails. Authenticating manually (decrypting TLS, capturing the id_token from the Azure response) using the id_token works as desired.

Ref: https://github.com/coder/registry/blob/main/registry/coder/modules/vault-jwt/main.tf#L62 and https://github.com/coder/registry/blob/main/registry/coder/modules/vault-jwt/run.sh#L119

The second half of this is a Terraform provider update - coder/terraform-provider-coder#471

@rowansmithau rowansmithau self-assigned this Dec 1, 2025
@rowansmithau rowansmithau added needs-triage Issue that require triage enhancement labels Dec 1, 2025
@rowansmithau rowansmithau changed the title feat: Add support for capturing id token returned by Azure OIDC login feat: add support for capturing id token returned by Azure OIDC login Dec 1, 2025
@rowansmithau rowansmithau force-pushed the rowansmithau/feat/add-oidc-id-token-env-var branch 5 times, most recently from 6fef761 to 17683bf Compare December 1, 2025 07:56
@matifali matifali removed the needs-triage Issue that require triage label Dec 1, 2025
@rowansmithau rowansmithau force-pushed the rowansmithau/feat/add-oidc-id-token-env-var branch 4 times, most recently from bc89d5f to 2964b75 Compare December 1, 2025 10:07
…DC_ID_TOKEN env var

- Add oauth_id_token column to user_links table (migration 402)
- Capture and store ID token during OIDC authentication
- Implement token refresh with ID token preservation
- Add obtainOIDCIdToken() function for token retrieval
- Pass ID token to provisioner via proto metadata
- Expose as CODER_WORKSPACE_OWNER_OIDC_ID_TOKEN environment variable
- Fix OAuthIdToken -> OAuthIDToken field naming (Go conventions)
- Add OAuthIDToken to all UpdateUserLinkParams/InsertUserLinkParams structs
- Update TypeScript and Go proto bindings
- Regenerate database queries with correct column ordering

This enables Azure OIDC authentication which requires the ID token
for subsequent API calls.
@rowansmithau rowansmithau force-pushed the rowansmithau/feat/add-oidc-id-token-env-var branch from 2964b75 to ab4366f Compare December 1, 2025 23:12
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2025
@rowansmithau rowansmithau reopened this Dec 1, 2025
@rowansmithau rowansmithau marked this pull request as ready for review December 1, 2025 23:31
@coder coder unlocked this conversation Dec 1, 2025
@spikecurtis
Copy link
Contributor

I added some more discussion in the linked Slack thread. Not sure yet this is needed.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2025
@rowansmithau rowansmithau deleted the rowansmithau/feat/add-oidc-id-token-env-var branch December 9, 2025 22:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants