-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
If I have a context configuration that holds an access_token and/or refresh_token and that it gets invalidate outside of this context, then on the next getToken, as long as the token is not expired it will be returned although it's invalid.
This applies for both action and cli config
Reproduce
const { Ims, getToken, invalidateToken, context } = require('.')
const config = {
client_id: "<jwt-clientid>",
client_secret: "XXX",
techacct: "<guid>@techacct.adobe.com",
meta_scopes: [
"ent_dataservices_sdk"
],
ims_org_id: "<org-guid>@AdobeOrg",
private_key: "XXX"
}
await context.set('my-ctx', config)
const token = await getToken('my-ctx')
// await invalidateToken('my-ctx') => would delete the token in the config
// but if the token is invalidate elsewhere the token would still be in the config
// example
const ims = new Ims('prod')
await ims.invalidateToken(token, config.clientId, config.clientSecret)
const token2 = await getToken('my-ctx') // would return the same cached token which is invalid
// furthermore now a call to invalidateToken will throw an error as the token is not validPossible solution
in every getTokenIfValid call in token-helper.js validate the token against IMS, however this will trigger many more requests and reduces the advantage of caching the token
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working