Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token invalidation outside of a single lib core ims context is not handled #21

Open
moritzraho opened this issue Feb 12, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@moritzraho
Copy link
Member

moritzraho commented Feb 12, 2020

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 valid

Possible 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

@shazron
Copy link
Member

shazron commented Feb 13, 2020

I'm thinking invalidateToken should just clear out the cached token.

@moritzraho
Copy link
Member Author

yeah it does so already, it's regarding invalidation of the token done outside of the context or outside of aio-lib-core-ims

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants