File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { base64FromBytes } from "../../../shared/src" ;
2
2
import { HUB_URL } from "../consts" ;
3
3
import { createApiError } from "../error" ;
4
+ import { randomUUID } from "../utils/randomUUID" ;
4
5
5
6
/**
6
7
* Use "Sign in with Hub" to authenticate a user, and get oauth user info / access token.
@@ -87,9 +88,9 @@ export async function oauthLoginUrl(opts?: {
87
88
userinfo_endpoint : string ;
88
89
} = await openidConfigRes . json ( ) ;
89
90
90
- const newNonce = crypto . randomUUID ( ) ;
91
+ const newNonce = await randomUUID ( ) ;
91
92
// Two random UUIDs concatenated together, because min length is 43 and max length is 128
92
- const newCodeVerifier = crypto . randomUUID ( ) + crypto . randomUUID ( ) ;
93
+ const newCodeVerifier = ( await randomUUID ( ) ) + ( await randomUUID ( ) ) ;
93
94
94
95
localStorage . setItem ( "huggingface.co:oauth:nonce" , newNonce ) ;
95
96
localStorage . setItem ( "huggingface.co:oauth:code_verifier" , newCodeVerifier ) ;
You canāt perform that action at this time.
0 commit comments