-
Notifications
You must be signed in to change notification settings - Fork 317
Closed
Labels
enhancementAn enhancement or improvement to the SDK that could not be otherwise categorized as a new featureAn enhancement or improvement to the SDK that could not be otherwise categorized as a new feature
Description
Describe the problem you'd like to have solved
As the cache of the Management API's token is local to the execution process we end-up generating a lot of Machine-to-Machine tokens when scaling our application horizontally. Having a way to decentralised the cache would help us to reduce the number of generated tokens.
Describe the ideal solution
Ideally we could pass a method to the token properties to handle ourselves the caching mechanism:
const auth0ManagementClient = new ManagementClient({
token: () => Promise.resolve('my-token')
clientId,
domain,
audience,
scope,
});We can also imagine leveraging on the existing Automatic Management API Token Retrieval features:
const auth0ManagementClient = new ManagementClient({
tokenProvider: {
enableCache: true,
setCache: (token) => saveCachedToken(token),
getCache: () => getCachedToken()
}
});Alternatives and current work-arounds
Currently the only solution I see is to create multiple instance of the ManagementClient to control which token is passed to it.
Additional information, if any
Metadata
Metadata
Assignees
Labels
enhancementAn enhancement or improvement to the SDK that could not be otherwise categorized as a new featureAn enhancement or improvement to the SDK that could not be otherwise categorized as a new feature