Spaces:
Sleeping
Sleeping
| title: Loginbutton | |
| emoji: ๐ | |
| colorFrom: green | |
| colorTo: indigo | |
| sdk: gradio | |
| sdk_version: 4.36.1 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| hf_oauth: true | |
| Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |
| > OAuth (Login via Hugging Face) | |
| > Gradio natively supports OAuth login via Hugging Face. In other words, you can easily add a "Sign in with Hugging Face" button to your demo, which allows you to get a user's HF username as well as other information from their HF profile. Check out this Space for a live demo. | |
| > To enable OAuth, you must set hf_oauth: true as a Space metadata in your README.md file. This will register your Space as an OAuth application on Hugging Face. Next, you can use gr.LoginButton to add a login button to your Gradio app. Once a user is logged in with their HF account, you can retrieve their profile by adding a parameter of type gr.OAuthProfile to any Gradio function. The user profile will be automatically injected as a parameter value. If you want to perform actions on behalf of the user (e.g. list user's private repos, create repo, etc.), you can retrieve the user token by adding a parameter of type gr.OAuthToken. You must define which scopes you will use in your Space metadata (see documentation for more details). |