Skip to content

Commit

Permalink
Merge pull request #35 from arc-archive/feat/W-15791262/generate-code
Browse files Browse the repository at this point in the history
feat: fix util generate code challenge
  • Loading branch information
leandrogilcarrano authored May 31, 2024
2 parents a11aa8a + 123188a commit aace95c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function sha256(value) {
* @returns
*/
export function base64Buffer(buffer) {
return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))); // .replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/oauth2/ServerMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ module.exports.CodeServerMock = {
const secret = params.get('client_secret');
const verifier = params.get('code_verifier');
const verifierSettings = codeChallenges[code];
const challenge = verifier && verifierSettings ? crypto.createHash('sha256').update(verifier).digest('base64') : undefined;
const challenge = verifier && verifierSettings ? crypto.createHash('sha256').update(verifier).digest('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '') : undefined;

if (params.get('grant_type') !== 'authorization_code') {
result.set('error', 'invalid_grant');
Expand Down

0 comments on commit aace95c

Please sign in to comment.