0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

refactor(core): update custom JWT default code and function type definition

This commit is contained in:
Darcy Ye 2024-03-21 16:30:46 +08:00
parent a98bc3da54
commit 0599b0237a
No known key found for this signature in database
GPG key ID: B46F4C07EDEFC610

View file

@ -55,10 +55,12 @@ declare global {
* This function is called to get custom claims for the JWT token.
*
* @param {${JwtCustomizerTypeDefinitionKey.ClientCredentialsPayload}} token -The JWT token.
* @param {undefined} data - Logto internal data placeholder that can be used to pass additional information (temporarily not used but should be kept for future use)
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} envVariables - The environment variables.
*
* @returns The custom claims.
*/
getCustomJwtClaims: (token: ${JwtCustomizerTypeDefinitionKey.ClientCredentialsPayload}, envVariables: ${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}) => Promise<CustomJwtClaims>;
getCustomJwtClaims: (token: ${JwtCustomizerTypeDefinitionKey.ClientCredentialsPayload}, data: undefined, envVariables: ${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}) => Promise<CustomJwtClaims>;
}
const exports: Exports;
@ -86,6 +88,7 @@ const defaultClientCredentialsJwtCustomizerCode = `/**
* This function is called to get custom claims for the JWT token.
*
* @param {${JwtCustomizerTypeDefinitionKey.ClientCredentialsPayload}} token -The JWT token.
* @param {undefined} data - Logto internal data placeholder that can be used to pass additional information (temporarily not used but should be kept for future use)
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} [envVariables] - The environment variables.
*
* @returns The custom claims.
@ -172,7 +175,7 @@ export const environmentVariablesCodeExample = `exports.getCustomJwtClaims = asy
Authorization: apiKey,
}
});
const data = await response.json();
return {