Spaces:
Runtime error
Runtime error
hf sign in
Browse files- app/login/callback/page.tsx +19 -22
app/login/callback/page.tsx
CHANGED
|
@@ -7,24 +7,24 @@ async function getAuth(code: string) {
|
|
| 7 |
`${process.env.OAUTH_CLIENT_ID}:${process.env.OAUTH_CLIENT_SECRET}`
|
| 8 |
).toString("base64")}`;
|
| 9 |
|
| 10 |
-
const request = await fetch("https://huggingface.co/oauth/token", {
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
});
|
| 23 |
|
| 24 |
-
const response = await request
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
// console.log(response);
|
| 30 |
// if (!response.access_token) {
|
|
@@ -33,10 +33,7 @@ async function getAuth(code: string) {
|
|
| 33 |
// @ts-ignore
|
| 34 |
// cookies.set("access_token", response.access_token, {});
|
| 35 |
|
| 36 |
-
return {
|
| 37 |
-
...response,
|
| 38 |
-
client_id: process.env.OAUTH_CLIENT_SECRET,
|
| 39 |
-
};
|
| 40 |
} catch (error) {
|
| 41 |
return error;
|
| 42 |
}
|
|
@@ -51,7 +48,7 @@ export default async function LoginCallback({
|
|
| 51 |
return (
|
| 52 |
<div className="pb-32 text-white">
|
| 53 |
<p className="font-bold text-4xl text-white">LOGIN CALLBACK</p>
|
| 54 |
-
{profile && JSON.stringify(profile, null, 2)}
|
| 55 |
</div>
|
| 56 |
);
|
| 57 |
}
|
|
|
|
| 7 |
`${process.env.OAUTH_CLIENT_ID}:${process.env.OAUTH_CLIENT_SECRET}`
|
| 8 |
).toString("base64")}`;
|
| 9 |
|
| 10 |
+
// const request = await fetch("https://huggingface.co/oauth/token", {
|
| 11 |
+
// method: "POST",
|
| 12 |
+
// headers: {
|
| 13 |
+
// "Content-Type": "application/x-www-form-urlencoded",
|
| 14 |
+
// Authorization,
|
| 15 |
+
// },
|
| 16 |
+
// // send as Form data
|
| 17 |
+
// body: new URLSearchParams({
|
| 18 |
+
// grant_type: "authorization_code",
|
| 19 |
+
// code,
|
| 20 |
+
// redirect_uri: REDIRECT_URI,
|
| 21 |
+
// }),
|
| 22 |
+
// });
|
| 23 |
|
| 24 |
+
// const response = await request
|
| 25 |
+
// .clone()
|
| 26 |
+
// .json()
|
| 27 |
+
// .catch(() => ({}));
|
| 28 |
|
| 29 |
// console.log(response);
|
| 30 |
// if (!response.access_token) {
|
|
|
|
| 33 |
// @ts-ignore
|
| 34 |
// cookies.set("access_token", response.access_token, {});
|
| 35 |
|
| 36 |
+
return {};
|
|
|
|
|
|
|
|
|
|
| 37 |
} catch (error) {
|
| 38 |
return error;
|
| 39 |
}
|
|
|
|
| 48 |
return (
|
| 49 |
<div className="pb-32 text-white">
|
| 50 |
<p className="font-bold text-4xl text-white">LOGIN CALLBACK</p>
|
| 51 |
+
{/* {profile && JSON.stringify(profile, null, 2)} */}
|
| 52 |
</div>
|
| 53 |
);
|
| 54 |
}
|