Skip to content

Commit ab75d7c

Browse files
committed
fix: Implement codeVerifier methods for automated Oauth provider
1 parent c3dae9b commit ab75d7c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

e2e_tests/typescript/src/server_clients/automated_oauth.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ export class AutomatedOAuthClient extends Server {
405405
class AutomatedOAuthClientProvider implements OAuthClientProvider {
406406
private _clientInformation: OAuthClientInformationFull;
407407
private _tokens?: OAuthTokens;
408+
private _codeVerifier?: string;
408409

409410
constructor(
410411
private readonly _clientMetadata: OAuthClientMetadata,
@@ -451,16 +452,13 @@ class AutomatedOAuthClientProvider implements OAuthClientProvider {
451452
}
452453

453454
saveCodeVerifier(codeVerifier: string): void {
454-
// Not used in client credentials flow
455-
throw new Error(
456-
"saveCodeVerifier should not be called in automated OAuth flow"
457-
);
455+
this._codeVerifier = codeVerifier;
458456
}
459457

460458
codeVerifier(): string {
461-
// Not used in client credentials flow
462-
throw new Error(
463-
"codeVerifier should not be called in automated OAuth flow"
464-
);
459+
if (!this._codeVerifier) {
460+
throw new Error("No code verifier saved");
461+
}
462+
return this._codeVerifier;
465463
}
466464
}

0 commit comments

Comments
 (0)