mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 14:22:52 +00:00
Cleanup token.js
This commit is contained in:
@@ -5,21 +5,16 @@ import config from './config.js';
|
|||||||
const generateAccessToken = (account)=>{
|
const generateAccessToken = (account)=>{
|
||||||
const payload = account;
|
const payload = account;
|
||||||
|
|
||||||
// When the token was issued
|
payload.issued = (new Date()); // When the token was issued
|
||||||
payload.issued = (new Date());
|
payload.issuer = config.get('authentication_token_issuer'); // Which service issued the Token
|
||||||
// Which service issued the Token
|
payload.audience = config.get('authentication_token_audience'); // Which service is the token intended for
|
||||||
payload.issuer = config.get('authentication_token_issuer');
|
const secret = config.get('authentication_token_secret'); // The signing key for signing the token
|
||||||
// Which service is the token intended for
|
|
||||||
payload.audience = config.get('authentication_token_audience');
|
|
||||||
// The signing key for signing the token
|
|
||||||
delete payload.password;
|
delete payload.password;
|
||||||
delete payload._id;
|
delete payload._id;
|
||||||
|
|
||||||
const secret = config.get('authentication_token_secret');
|
|
||||||
|
|
||||||
const token = jwt.encode(payload, secret);
|
const token = jwt.encode(payload, secret);
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default generateAccessToken;
|
export default generateAccessToken;
|
||||||
|
|||||||
Reference in New Issue
Block a user