Skip to content

Commit c06fafb

Browse files
authored
fix: generatePKCEChallenge should use btoa (#1044)
`stringToBase64URL` expects a unicode string [not a data string](https://developer.mozilla.org/en-US/docs/Web/API/Window/btoa).
1 parent 21ec146 commit c06fafb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export async function generatePKCEChallenge(verifier: string) {
289289
return verifier
290290
}
291291
const hashed = await sha256(verifier)
292-
return stringToBase64URL(hashed)
292+
return btoa(hashed).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
293293
}
294294

295295
export async function getCodeChallengeAndMethod(

0 commit comments

Comments
 (0)