Skip to content

Commit

Permalink
Remove helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanet Trimas committed Jul 2, 2024
1 parent 16e3da5 commit f8bdb2a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/oauth2-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { randomUUID } from 'crypto';

import { OAuth2Issuer } from './oauth2-issuer';
import {
assertIsCodeChallenge,
assertIsString,
assertIsStringOrUndefined,
assertIsValidTokenRequest,
Expand Down Expand Up @@ -206,7 +205,11 @@ export class OAuth2Service extends EventEmitter {
const code = req.body.code;
const verifier = req.body['code_verifier'];
const savedCodeChallenge = this.#codeChallenges.get(code);
assertIsCodeChallenge(savedCodeChallenge);
if (savedCodeChallenge === undefined) {
throw new AssertionError({
message: 'code_challenge required',
});
}
this.#codeChallenges.delete(code);
if (!isValidPkceCodeVerifier(verifier)) {
throw new AssertionError({
Expand Down

0 comments on commit f8bdb2a

Please sign in to comment.