https://github.com/compwright/oauth2-server-jwt
Storageless JWT token generator backend for oauth2-server
https://github.com/compwright/oauth2-server-jwt
jwt oauth2-server
Last synced: 9 months ago
JSON representation
Storageless JWT token generator backend for oauth2-server
- Host: GitHub
- URL: https://github.com/compwright/oauth2-server-jwt
- Owner: compwright
- License: mit
- Created: 2018-08-06T04:19:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-02-25T14:24:52.000Z (10 months ago)
- Last Synced: 2025-03-27T14:47:44.656Z (9 months ago)
- Topics: jwt, oauth2-server
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/oauth2-server-jwt
- Size: 517 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# oauth2-server-jwt
[](https://app.travis-ci.com/compwright/oauth2-server-jwt)
[](https://www.npmjs.com/package/oauth2-server-jwt)
[](https://github.com/sponsors/compwright)
Storageless JWT token generator backend for [oauth2-server](https://github.com/compwright/node-oauth2-server)
## Features
* Respects oauth2-server token lifetime configuration for each type of token
* Generates JWT access tokens, refresh tokens, and authorization codes
## Limitations
For proper verification of `aud`, `scope`, and `redirectUri`, you will need to implement [`model.getClient()`](https://oauth2-server.readthedocs.io/en/latest/model/spec.html#getclient-clientid-clientsecret-callback) separately.
If you need to support the `password` grant type, you will also need to implement [`model.getUser()`](https://oauth2-server.readthedocs.io/en/latest/model/spec.html#getuser-username-password-callback) separately.
Suggested implementation: [oauth2-server-mongoose](https://github.com/compwright/oauth2-server-mongoose)
## Requirements
* Node.js 12+
* [oauth2-server](https://github.com/compwright/node-oauth2-server)
## Installation
```bash
$ npm install --save @compwright/oauth2-server oauth2-server-jwt
```
## Usage
```javascript
const OAuth2Server = require('@compwright/oauth2-server');
const jwtMixin = require('oauth2-server-jwt');
const mongooseMixin = require('oauth2-server-mongoose');
const oauth = new OAuth2Server({
model: {
...jwtMixin({
accessTokenSecret, // String (required)
refreshTokenSecret, // String (required)
authorizationCodeSecret, // String (required)
issuer, // String (required)
userId: 'id' // String
algorithms: ['HS256'] // Array[String]
}),
...mongooseMixin()
}
});
```
## License
MIT license