{"repo":"curityio/express-oauth-jwt","free":true,"listed":false,"github":"https://github.com/curityio/express-oauth-jwt","clone":"git clone https://github.com/curityio/express-oauth-jwt.git","description":"A Node.js Express example API Secured with OAuth tokens","language":"JavaScript","stars":11,"topics":["api","claims","jwt-validation","oauth2","scopes","zero-trust","sdk"],"license":"Apache-2.0","category":"auth-billing-email","readme_excerpt":"Securing endpoints in Express with OAuth JWT tokens This library allows you to secure your Express endpoints with JWTs. The implementation uses a JWKS endpoint of an Authorization Server to get keys required for the verification of the token signature. Running the example 1. Download the code and install dependencies running npm i . 2. In settings.js in the example directory set the URI of the JWKS endpoint exposed by the Authorization Server. 3. Start the demo server with npm run example . 4. The server exposes endpoints /secured/token , /secured/scope and /secured/claim which present different options of securing the endpoints. Installing the dependency Use npm to install the library in your project: Usage Preparing the Middleware The secure middleware needs a method to obtain keys. You can use the jose -provided method, or create your own instance. The method is responsible for obtaining signature verification keys for a concrete token, and has the signature: function(headerParameters: JWSHeaderParameters, input: FlattenedJWSInput): Promise KeyLike Uint8Array The easiest way is to use the method provided by the jose library. The method caches the result of the JWKS endpoint request in memory to limit sending requests to the server. Securing an endpoint To secure an endpoint apply the secure middleware to it. Any endpoint with this middleware applied will require a valid JWT token sent in the Authorization header in the form Bearer . The token, if valid, will be decoded and","default_branch":null,"files":null,"tree":[],"storefront":"/r/curityio","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/curityio/express-oauth-jwt/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}