{"id":19737979,"url":"https://github.com/devsu/condor-jwt","last_synced_at":"2026-05-09T07:38:19.493Z","repository":{"id":57205268,"uuid":"89743181","full_name":"devsu/condor-jwt","owner":"devsu","description":"Authenticate GRPC calls in node using JWTs. Middleware for Condor GRPC Framework.","archived":false,"fork":false,"pushed_at":"2017-05-05T19:36:10.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-10T19:27:38.105Z","etag":null,"topics":["condor","grpc","grpc-framework","jsonwebtoken","jwt","middleware","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devsu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-28T20:40:12.000Z","updated_at":"2018-09-28T13:57:29.000Z","dependencies_parsed_at":"2022-09-18T00:50:43.243Z","dependency_job_id":null,"html_url":"https://github.com/devsu/condor-jwt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devsu","download_url":"https://codeload.github.com/devsu/condor-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241067639,"owners_count":19903855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["condor","grpc","grpc-framework","jsonwebtoken","jwt","middleware","nodejs"],"created_at":"2024-11-12T01:12:59.094Z","updated_at":"2026-05-09T07:38:14.461Z","avatar_url":"https://github.com/devsu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# condor-jwt\n\nThis module lets you authenticate GRPC calls using JSON Web Tokens (**JWTs**) in your [Condor](https://github.com/devsu/condor-framework) GRPC services.\n\n[![Build Status](https://travis-ci.org/devsu/condor-jwt.svg?branch=master)](https://travis-ci.org/devsu/condor-jwt)\n[![Coverage Status](https://coveralls.io/repos/github/devsu/condor-jwt/badge.svg?branch=master)](https://coveralls.io/github/devsu/condor-jwt?branch=master)\n\n**Condor** is a [GRPC Framework for node](https://github.com/devsu/condor-framework).\n\n## Installation\n\n```bash\nnpm i --save condor-framework condor-jwt\n```\n\n## How to use\n\nThe JWT middleware decodes and verifies a JsonWebToken passed in the `authorization` header. If the token is valid, `context.token` (by default) will be set with the JSON object decoded to be used by later middleware for authorization and access control.\n\n```js\nconst Condor = require('condor-framework');\nconst jwt = require('condor-jwt');\nconst Greeter = require('./greeter');\n\nconst app = new Condor()\n  .addService('./protos/greeter.proto', 'myapp.Greeter', new Greeter())\n  .use(jwt({'secretOrPublicKey': 'shhhhh'}))\n  // middleware below this line is only reached if JWT token is valid\n  .use((context, next) =\u003e {\n    console.log('valid token found: ', context.token);\n    next();\n  })\n  .start();\n```\n\n## Custom Methods\n\nBy default, the token will be retrieved from the `authorization` metadata. Also, you can provide your own method to retrieve the token. The method can be sync or async (return a promise). It must return the token object if found and valid, or null otherwise. The method will be called with the context.\n\n```js\noptions = {\n  'getToken': (context) =\u003e {\n    // do your magic here\n    return token;\n  },\n};\n```\n\nIn the same manner, you can provide your `isRevoked` method to determine if a token is revoked. The method can be sync or async (return a promise). If the token is not revoked, the method must return false or resolve with false.\n\n```js\noptions = {\n  'isRevoked': (context, token) =\u003e {\n    // do your magic here\n    return false;\n  },\n};\n```\n\n## Options\n\n| Option            | Description                                                                                                             |\n|-------------------|-------------------------------------------------------------------------------------------------------------------------|\n| getToken          | Custom method to get the token                                                                                          |\n| isRevoked         | Custom method to verify if a token is revoked                                                                           |\n| propertyName      | Where to store the token in the context. Default is `token`                                                             |\n| passthrough       | Continue to next, even if no valid authorization token was found. Default is `false`                                    |\n| secretOrPublicKey | a string or buffer containing either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA    |\n\nAdditionaly, you can send any option of the [verify](https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback) method of the [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) module:\n\n- algorithms\n- audience\n- issuer\n- ignoreExpiration\n- subject\n- clockTolerance\n- maxAge\n- clockTimestamp\n\nSuch options will be used to verify the token.\n\n## License and Credits\n\nMIT License. Copyright 2017 \n\nBuilt by the [GRPC experts](https://devsu.com) at Devsu.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsu%2Fcondor-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevsu%2Fcondor-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsu%2Fcondor-jwt/lists"}