Download src/lib/providers/huggingface.js from NeoPy/hugging-c-ai: direct link, hf CLI and curl.
- Browser
- Download file 909 Bytes
-
https://huggingface.co/NeoPy/hugging-c-ai/resolve/main/src/lib/providers/huggingface.js
- Command line
-
hf download hf://NeoPy/hugging-c-ai/src/lib/providers/huggingface.js
-
curl -L -o huggingface.js https://huggingface.co/NeoPy/hugging-c-ai/resolve/main/src/lib/providers/huggingface.js
909 Bytes
| /** | |
| * HuggingFace OAuth2 provider for NextAuth v4. | |
| * Scopes: openid profile email repo:write read | |
| */ | |
| export default function HuggingFaceProvider(options) { | |
| return { | |
| id: "huggingface", | |
| name: "Hugging Face", | |
| type: "oauth", | |
| version: "2.0", | |
| authorization: { | |
| url: "https://huggingface.co/oauth/authorize", | |
| params: { | |
| scope: "openid profile email repo:write read", | |
| response_type: "code", | |
| }, | |
| }, | |
| token: "https://huggingface.co/oauth/token", | |
| userinfo: "https://huggingface.co/oauth/userinfo", | |
| clientId: options.clientId, | |
| clientSecret: options.clientSecret, | |
| profile(profile) { | |
| return { | |
| id: profile.sub, | |
| name: profile.name || profile.preferred_username || "HF User", | |
| email: profile.email, | |
| image: profile.picture, | |
| hfUsername: profile.preferred_username || profile.name, | |
| }; | |
| }, | |
| }; | |
| } | |