Skip to main content

generateCodeVerifier

Documentation


Documentation / @discordeno/utils / generateCodeVerifier

Function: generateCodeVerifier()

generateCodeVerifier(octetLength): string

Defined in: packages/utils/src/oauth2.ts:38

Generates a code verifier for use in the PKCE extension to OAuth2.

Parameters

octetLength

number = 32

The length of the code verifier in octets (default is 32).

Returns

string

The base64url encoded code verifier

Remarks

The entropy of the code verifier should be between 256 and 768 bits (32 to 96 octets), as the resulting base64url encoded string has to be between 43 and 128 characters long.

See