VibeGame / test-oauth.html
dylanebert's picture
dylanebert HF Staff
initial commit
794cf6c
<!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>