Spaces:
Running
Running
File size: 1,034 Bytes
794cf6c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<!doctype html>
<html>
<head>
<title>OAuth Test</title>
</head>
<body>
<h1>OAuth Test</h1>
<button id="test-btn">Test OAuth URL Generation</button>
<div id="result"></div>
<script type="module">
import { oauthLoginUrl } from "@huggingface/hub";
document
.getElementById("test-btn")
.addEventListener("click", async () => {
try {
const url = await oauthLoginUrl({
clientId: "87f5f1d1-6e9e-4962-98f0-e5f3831ec988",
redirectUrl: "http://localhost:7860/auth/callback",
scopes: "openid profile inference-api",
});
document.getElementById("result").innerHTML = `
<p>OAuth URL generated successfully:</p>
<a href="${url}" target="_blank">${url}</a>
`;
} catch (error) {
document.getElementById("result").innerHTML = `
<p style="color: red;">Error: ${error.message}</p>
`;
}
});
</script>
</body>
</html>
|