Add Hugging Face as a social connection
You will learn the following:
- Use Hugging Face to authenticate users with OAuth.
Enabling OAuth with Hugging Face allows your users to sign in and sign up to your Clerk application with their Hugging Face account.
Configure for your development instance
For development instances, Clerk uses preconfigured shared OAuth credentials and redirect URIs — no other configuration is needed.
To configure your development instance, follow these steps:
- Navigate to the Clerk Dashboard.
- In the top navigation, select Configure. Then in the sidebar, select SSO Connections.
- Select the Add connection button, and select For all users.
- In the Choose provider dropdown, select Hugging Face.
- Select Add connection.
Configure for your production instance
In production instances, you must provide custom credentials, which involves generating your own Client ID and Client Secret using your Hugging Face account.
To configure your production instance, follow these steps:
Create a Hugging Face Connected App
- Navigate to Hugging Face and sign in to your account.
- in the top right corner, select your avatar and select Settings.
- In the sidebar, select Connected Apps.
- Under Developer Applications, select Create App.
- Fill out the form as follows:
- Application Name: Name the application whatever you'd like.
- Homepage URL: Enter the homepage URL of your application.
- Logo URL: Enter the URL of the logo for your application.
- Token Expiration: Set the duration for which the token will be valid.
- Scopes: Select the scopes that your application requires. Ensure that openid, profile, and email are included.
- Redirect URLs: You will need to add the Redirect URI from Clerk. See the next step.
Get your Redirect URI from Clerk
- Navigate to the Clerk Dashboard.
- In the top navigation, select Configure. Then in the sidebar, select SSO Connections.
- Select the Add connection button, and select For all users.
- In the Choose provider dropdown, select Hugging Face.
- Ensure that both Enable for sign-up and sign-in and Use custom credentials are toggled on. Then, copy the Redirect URI.
- Navigate back to Hugging Face and paste the Redirect URI into the Redirect URLs field.
- Select Create application.
Set the Client ID and Client Secret in Clerk
- Once you have created your Hugging Face Connected App, copy the Client ID and App Secret.
- Navigate back to the Clerk Dashboard.
- In the Client ID and Client Secret field, paste the values you copied from Hugging Face.
- Select Add connection.
Test your OAuth
The simplest way to test your OAuth is to visit your Clerk application's Account Portal, which is available for all Clerk applications out-of-the-box.
- In the navigation sidebar of the Clerk Dashboard, select Account Portal.
- Next to the Sign-in URL, select Visit. The URL should resemble:
- For development – https://your-domain.accounts.dev/sign-in
- For production – https://accounts.your-domain.com/sign-in
- On the sign-in page, you should see Hugging Face as an option. Use it to sign in with your Hugging Face account.
Feedback
Last updated on