This commit is contained in:
Twilight 2024-09-10 16:49:14 +08:00
parent 3f5cfd34a8
commit 5aa893d26e

View File

@ -24,7 +24,7 @@ function generateRandomString(length: number) {
async function generateCodeChallenge(codeVerifier: string) { async function generateCodeChallenge(codeVerifier: string) {
const digest = await crypto.subtle.digest( const digest = await crypto.subtle.digest(
"SHA-256", "SHA-256",
new TextEncoder().encode(codeVerifier), new TextEncoder().encode(codeVerifier)
); );
return btoa(String.fromCharCode(...new Uint8Array(digest))) return btoa(String.fromCharCode(...new Uint8Array(digest)))
@ -49,10 +49,9 @@ async function go() {
const discovery = await axios.get(config.oauth_discovery_url); const discovery = await axios.get(config.oauth_discovery_url);
const a = document.createElement('a') const a = document.createElement("a");
a.href = discovery.data.authorization_endpoint + '?' + query a.href = discovery.data.authorization_endpoint + "?" + query;
a.click() a.click();
} }
go(); go();