Git Product home page Git Product logo

iam-token-manager-nodejs's People

Contributors

aseidel77 avatar csantanapr avatar dependabot[bot] avatar jasonpet avatar luke-roy-ibm avatar pgarrett-twc avatar reggeenr avatar srl295 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

iam-token-manager-nodejs's Issues

[Bug] Many 'concurrent' getAuthHeader() calls cause 429 response from IAM

The OpenWhisk SDK uses the iam-token-manager package to plug in IAM token support as the default authHandler for openwhisk client instances that interact with IAM namespaces.

When customers try to invoke many actions from one other action, they inadvertently trigger a lot of getAuthHeader() calls on the iam-token-manager 'concurrently'. The word 'concurrently' is in quotation marks, as nodejs is single threaded, yet while the getToken() request is in-flight, all the other getAuthHeader() calls trigger many more (unnecessary) getToken() requests.

This leads to a 429 'Too many request' Denial of Service protection error from the IAM token API.

Therefore, the caching behavior for the tokenInfo (Token Request response JSON) and the logic for when to request another token needs to be improved.

For simple scenarios, the code is working just fine, so this issue could be considered an enhancement as well.

Fyi: I have some code that addresses this issue ready soon.

package.json: engine is too restrictive

npm WARN notsup Unsupported engine for @ibm-functions/[email protected]: wanted: {"node":"^12.x","npm":"6.4.1"} (current: {"node":"12.17.0","npm":"6.14.4"})

Why does the engine: field have npm: 6.4.1 exactly? Seems like it should be npm: ^6.x or unspecified.

Adjust the refresh logic for expired access tokens

Currently, the token manager uses the refreshToken to obtain a new access token, in case the access token has been expired. This may lead to unforeseen issues, if the refresh token expired as well. There is logic in place that should handle this case, but we do have the indication that the mechanism does not work properly.

The token manager should in all cases use the API key to obtain a new access token.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.