enzostvs HF Staff commited on
Commit
cf46856
·
1 Parent(s): d04cadb

hf sign in

Browse files
Files changed (1) hide show
  1. 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
- 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,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
  }