update jwt
This commit is contained in:
@ -15,7 +15,15 @@ export default class JwtHelper {
|
|||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
expressjwt({
|
expressjwt({
|
||||||
secret: publicKey, algorithms: ["RS256"]
|
secret: publicKey, algorithms: ["RS256"],
|
||||||
|
getToken: function fromHeaderOrQuerystring(req): any {
|
||||||
|
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
|
||||||
|
return req.headers.authorization.split(' ')[1];
|
||||||
|
} else if (req.query && req.query.token) {
|
||||||
|
return req.query.token;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
}).unless({ path: ["/token"] }),
|
}).unless({ path: ["/token"] }),
|
||||||
function (req: Request, res: Response, next: NextFunction) {
|
function (req: Request, res: Response, next: NextFunction) {
|
||||||
if (!req.auth?.data.id) {
|
if (!req.auth?.data.id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user