thibaud frere
commited on
Commit
·
d18f624
1
Parent(s):
283947d
fix
Browse files- index.html +6 -0
index.html
CHANGED
|
@@ -32,6 +32,7 @@
|
|
| 32 |
<script>
|
| 33 |
// Utiliser le client_id injecté par Hugging Face dans l'environnement du Space
|
| 34 |
const CLIENT_ID = window.huggingface?.variables?.OAUTH_CLIENT_ID;
|
|
|
|
| 35 |
const REDIRECT_URI = window.location.origin + window.location.pathname;
|
| 36 |
const HF_OAUTH_URL = 'https://huggingface.co/oauth/authorize';
|
| 37 |
const HF_TOKEN_URL = 'https://huggingface.co/oauth/token';
|
|
@@ -82,12 +83,17 @@
|
|
| 82 |
return;
|
| 83 |
}
|
| 84 |
const code = params.get('code');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
const body = new URLSearchParams({
|
| 86 |
client_id: CLIENT_ID,
|
| 87 |
grant_type: 'authorization_code',
|
| 88 |
code: code,
|
| 89 |
redirect_uri: REDIRECT_URI
|
| 90 |
});
|
|
|
|
| 91 |
document.getElementById('status').textContent = 'Exchanging code for token...';
|
| 92 |
const resp = await fetch(HF_TOKEN_URL, {
|
| 93 |
method: 'POST',
|
|
|
|
| 32 |
<script>
|
| 33 |
// Utiliser le client_id injecté par Hugging Face dans l'environnement du Space
|
| 34 |
const CLIENT_ID = window.huggingface?.variables?.OAUTH_CLIENT_ID;
|
| 35 |
+
console.log('CLIENT_ID au chargement:', CLIENT_ID);
|
| 36 |
const REDIRECT_URI = window.location.origin + window.location.pathname;
|
| 37 |
const HF_OAUTH_URL = 'https://huggingface.co/oauth/authorize';
|
| 38 |
const HF_TOKEN_URL = 'https://huggingface.co/oauth/token';
|
|
|
|
| 83 |
return;
|
| 84 |
}
|
| 85 |
const code = params.get('code');
|
| 86 |
+
console.log('CLIENT_ID au moment de l\'échange:', CLIENT_ID);
|
| 87 |
+
console.log('window.huggingface:', window.huggingface);
|
| 88 |
+
console.log('window.huggingface.variables:', window.huggingface?.variables);
|
| 89 |
+
|
| 90 |
const body = new URLSearchParams({
|
| 91 |
client_id: CLIENT_ID,
|
| 92 |
grant_type: 'authorization_code',
|
| 93 |
code: code,
|
| 94 |
redirect_uri: REDIRECT_URI
|
| 95 |
});
|
| 96 |
+
console.log('Body de la requête:', body.toString());
|
| 97 |
document.getElementById('status').textContent = 'Exchanging code for token...';
|
| 98 |
const resp = await fetch(HF_TOKEN_URL, {
|
| 99 |
method: 'POST',
|