You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* // If the user is not logged in, redirect to the login page
21
+
* window.location.href = await oauthLoginUrl();
22
+
* }
23
+
*
24
+
* // You can use oauthResult.accessToken, oauthResult.accessTokenExpiresAt and oauthResult.userInfo
25
+
* console.log(oauthResult);
26
+
* ```
14
27
*
15
28
* (Theoretically, this function could be used to authenticate a user for any OAuth provider supporting PKCE and OpenID Connect by changing `hubUrl`,
16
29
* but it is currently only tested with the Hugging Face Hub.)
17
30
*/
18
-
exportasyncfunctionoauthLogin(opts?: {
31
+
exportasyncfunctionoauthLoginUrl(opts?: {
19
32
/**
20
33
* OAuth client ID.
21
34
*
@@ -46,12 +59,12 @@ export async function oauthLogin(opts?: {
46
59
*
47
60
* For Developer Applications, you can add any URL you want to the list of allowed redirect URIs at https://huggingface.co/settings/connected-applications.
48
61
*/
49
-
redirectUri?: string;
62
+
redirectUrl?: string;
50
63
/**
51
64
* State to pass to the OAuth provider, which will be returned in the call to `oauthLogin` after the redirect.
52
65
*/
53
66
state?: string;
54
-
}): Promise<void>{
67
+
}): Promise<string>{
55
68
if(typeofwindow==="undefined"){
56
69
thrownewError("oauthLogin is only available in the browser");
57
70
}
@@ -81,7 +94,7 @@ export async function oauthLogin(opts?: {
0 commit comments