1.0.7 • Published 6 days ago
@natlibfi/passport-melinda-jwt v1.0.7
Passport authentication strategy for Melinda using jwt tokens
Melinda implementation of passport + jwt token authorization
How to implement in server side
Create JWT token
import {generateJwtToken} from '@natlibfi/passport-melinda-jwt';
const token: generateJwtToken(payload, {
secretOrPrivateKey,
issuer,
audience,
algorithm
});
- secretOrPrivateKey: secret
- issuer: String value of issuer
- audience: String value of audience
- algorithm: encryption method default: 'HS512'
Check JWT token
import MelindaJwtStrategy, {verify, jwtFromRequest} from '@natlibfi/passport-melinda-jwt';
passport.use(new MelindaJwtStrategy({
secretOrKey
issuer,
audience,
algorithms,
jwtFromRequest
}, verify));
- secretOrKey: secret
- issuer: String value of issuer
- audience: String value of audience
- algorithms: String array, e.g. 'HS512'
- jwtFromRequest: Function that gets token from request (Default contained in this repository)
- verify: Function to verify token content (Default contained in this repository)
How to implement in client side
headers: {
Authorization: token,
}
- Send token as authorization header in requests
License and copyright
Copyright (c) 2021-2024 University Of Helsinki (The National Library Of Finland)
This project's source code is licensed under the terms of MIT or any later version.
1.0.7
6 days ago
1.0.7-alpha.1
6 days ago
1.0.6-alpha.1
12 days ago
1.0.6
12 days ago
2.0.0-alpha.2
29 days ago
2.0.0-alpha.1
1 month ago
1.0.5-alpha.1
5 months ago
1.0.5
5 months ago
1.0.4-alpha.1
9 months ago
1.0.4
9 months ago
1.0.3-alpha.1
10 months ago
1.0.3
10 months ago
1.0.2
1 year ago
1.0.2-alpha.1
1 year ago
1.0.1
3 years ago
1.0.0
3 years ago