Sign in with Hugging Face

You can use the HF OAuth / OpenID connect flow to create a “Sign in with HF” flow in any website or App.

This will allow users to sign in to your website or app using their HF account, by clicking a button similar to this one:

Sign in with Hugging Face

After clicking this button your users will be presented with a permissions modal to authorize your app:

Creating an oauth app

You can create your application in your settings:

If you are hosting in Spaces

If you host your app on Spaces, then the flow will be even easier to implement (and built-in to Gradio directly); Check our Spaces OAuth guide.

Currently supported scopes

The currently supported scopes are:

All other information is available in the OpenID metadata.

Please contact us if you need any extra scopes.

Accessing organization resources

By default, the oauth app does not need to access organization resources.

But some scopes like read-repos or read-billing apply to organizations as well.

The user can select which organizations to grant access to when authorizing the app. If you require access to a specific organization, you can add orgIds=ORG_ID as a query parameter to the OAuth authorization URL. You have to replace ORG_ID with the organization ID, which is available in the organizations.sub field of the userinfo response.

Branding

You are free to use your own design for the button. Below are some SVG images helpfully provided.

Check out our badges with explanations for integrating them in markdown or HTML.

Sign in with Hugging Face Sign in with Hugging Face

Sign in with Hugging Face Sign in with Hugging Face

Sign in with Hugging Face Sign in with Hugging Face

Sign in with Hugging Face Sign in with Hugging Face

< > Update on GitHub