Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Clerk as an OpenID Connect provider #1968

Merged
merged 4 commits into from
Feb 11, 2025

Conversation

chanioxaris
Copy link
Member

@chanioxaris chanioxaris commented Feb 3, 2025

🔎 Previews:

What does this solve?

  • Now you can use your Clerk instance, not only as an OAuth 2.0 provider, but also as an OpenID Connect (OIDC) provider

What changed?

  • We enhance the existing docs page, with the necessary data for the OpenID Connect flows

Checklist

  • I have clicked on "Files changed" and performed a thorough self-review
  • I have added the "deploy-preview" label and added the preview link(s) to this PR description
  • All existing checks pass

Copy link

github-actions bot commented Feb 3, 2025

Hey, here’s your docs preview: https://clerk.com/docs/pr/1968

@chanioxaris chanioxaris force-pushed the haris/user-911-update-public-docs-oauth-oidc branch from 72c6cad to 4727518 Compare February 3, 2025 11:05
docs/advanced-usage/clerk-idp.mdx Outdated Show resolved Hide resolved

In order to make your Clerk instance operate as an OAuth 2.0 provider, create an OAuth application in the Clerk Dashboard. Then, configure the client to work with your Clerk instance, using the necessary data from your Clerk OAuth application.
In order to make your Clerk instance operate as a provider, create an OAuth application in the Clerk Dashboard. Then, configure the client to work with your Clerk instance, using the necessary data from your Clerk OAuth application.
Copy link
Member

Choose a reason for hiding this comment

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

🙃 Wouldn't it be better to switch this part to "steps"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe here we just describe in a high level that you need to do in order to make this work. To create an OAuth application (IdP) and then use the information to configure the client (SP)

docs/advanced-usage/clerk-idp.mdx Outdated Show resolved Hide resolved
docs/advanced-usage/clerk-idp.mdx Outdated Show resolved Hide resolved
docs/advanced-usage/clerk-idp.mdx Outdated Show resolved Hide resolved
@@ -75,6 +76,42 @@ The `/oauth/userinfo` endpoint provides the following user properties, depending
| `private_metadata` | The private metadata of the user |
| `unsafe_metadata` | The unsafe metadata of the user |

### ID Token

The ID Token is a regular JSON Web Token (JWT) that contains user profile information. After a user successfully authenticates using the OpenID Connect flow, they receive an ID Token along with other tokens.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to capitalize T in the sentence.

Suggested change
The ID Token is a regular JSON Web Token (JWT) that contains user profile information. After a user successfully authenticates using the OpenID Connect flow, they receive an ID Token along with other tokens.
The ID token is a regular JSON Web Token (JWT) that contains user profile information. After a user successfully authenticates using the OpenID Connect flow, they receive an ID token along with other tokens.

Copy link
Member Author

Choose a reason for hiding this comment

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

As far i can see, in the spec they capitalize the T as they do for Access Tokens and Refresh Tokens

Copy link
Member

Choose a reason for hiding this comment

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

what spec?

Copy link
Member Author

Choose a reason for hiding this comment

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

@chanioxaris chanioxaris force-pushed the haris/user-911-update-public-docs-oauth-oidc branch from c6558c7 to 5349058 Compare February 5, 2025 07:10
docs/advanced-usage/clerk-idp.mdx Show resolved Hide resolved
docs/advanced-usage/clerk-idp.mdx Outdated Show resolved Hide resolved
docs/advanced-usage/clerk-idp.mdx Outdated Show resolved Hide resolved

The ID token is a JWT (JSON Web Token) that contains standard JWT claims as defined in RFC 7519, as well as additional custom claims that represent the authenticated user's profile information. The token is signed using your instance's private key and can be verified using the corresponding public key.

{/* TODO: How do they use the public key to validate the token? */}
Copy link
Member Author

Choose a reason for hiding this comment

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

They can validate it as any other regular JWT that has been generated and signed by their instance. For example the Clerk session token. You can obtain the instance public key from the JWKS endpoint. I believe we don't need to add any additional information on how to do it. Maybe a link to a page that describes how to verify their instance JWT is enough

@chanioxaris chanioxaris merged commit 32b5fef into main Feb 11, 2025
6 checks passed
@chanioxaris chanioxaris deleted the haris/user-911-update-public-docs-oauth-oidc branch February 11, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants