File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { base64FromBytes } from "../../../shared/src" ;
1
2
import { HUB_URL } from "../consts" ;
2
3
import { createApiError } from "../error" ;
3
- import { hexFromBytes } from "../utils/hexFromBytes" ;
4
4
5
5
/**
6
6
* Use "Sign in with Hub" to authenticate a user, and get oauth user info / access token.
@@ -243,9 +243,12 @@ export async function oauthLogin(opts?: {
243
243
throw new Error ( "Missing clientId" ) ;
244
244
}
245
245
246
- const challenge = hexFromBytes (
246
+ const challenge = base64FromBytes (
247
247
new Uint8Array ( await globalThis . crypto . subtle . digest ( "SHA-256" , new TextEncoder ( ) . encode ( newCodeVerifier ) ) )
248
- ) ;
248
+ )
249
+ . replace ( / [ + ] / g, "-" )
250
+ . replace ( / [ / ] / g, "_" )
251
+ . replace ( / = / g, "" ) ;
249
252
250
253
window . location . href = `${ opendidConfig . authorization_endpoint } ?${ new URLSearchParams ( {
251
254
client_id : clientId ,
You can’t perform that action at this time.
0 commit comments