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:
parent
a98bc3da54
commit
0599b0237a
1 changed files with 5 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue