Commit
·
b198b14
1
Parent(s):
9248d57
Update index.js
Browse files
index.js
CHANGED
|
@@ -177,9 +177,12 @@ async function oauthLogin(opts) {
|
|
| 177 |
throw new Error("Missing clientId");
|
| 178 |
}
|
| 179 |
|
| 180 |
-
const challenge =
|
| 181 |
new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(newCodeVerifier)))
|
| 182 |
-
)
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
console.log("localstorage after", JSON.parse(JSON.stringify(localStorage)))
|
| 185 |
console.log("challenge after", challenge, newCodeVerifier)
|
|
|
|
| 177 |
throw new Error("Missing clientId");
|
| 178 |
}
|
| 179 |
|
| 180 |
+
const challenge = base64FromBytes(
|
| 181 |
new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(newCodeVerifier)))
|
| 182 |
+
)
|
| 183 |
+
.replace(/[+]/g, "-")
|
| 184 |
+
.replace(/[/]/g, "_")
|
| 185 |
+
.replace(/=/g, "");
|
| 186 |
|
| 187 |
console.log("localstorage after", JSON.parse(JSON.stringify(localStorage)))
|
| 188 |
console.log("challenge after", challenge, newCodeVerifier)
|