Update token generation (#1372)
- Permit only decode token to get map details, - If user have token expired, set the token to null and reload the page. This feature will be updated when authentication stategy will be finished. Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
parent
02a21209ec
commit
8d57886bae
4 changed files with 31 additions and 9 deletions
|
@ -15,9 +15,9 @@ class JWTTokenManager {
|
|||
return Jwt.sign({ identifier }, SECRET_KEY, { expiresIn: "200d" });
|
||||
}
|
||||
|
||||
public decodeJWTToken(token: string): AuthTokenData {
|
||||
public verifyJWTToken(token: string, ignoreExpiration: boolean = false): AuthTokenData {
|
||||
try {
|
||||
return Jwt.verify(token, SECRET_KEY, { ignoreExpiration: false }) as AuthTokenData;
|
||||
return Jwt.verify(token, SECRET_KEY, { ignoreExpiration }) as AuthTokenData;
|
||||
} catch (e) {
|
||||
throw { reason: tokenInvalidException, message: e.message };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue