Ajustando definicao do AccessToken
This commit is contained in:
parent
05f4e4c1e6
commit
b23980922e
2 changed files with 4 additions and 3 deletions
|
@ -30,7 +30,8 @@ export interface AccessToken {
|
|||
token_type: string;
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
created_at: number;
|
||||
scope?: string;
|
||||
created_at?: number;
|
||||
}
|
||||
|
||||
export enum GrantType {
|
||||
|
|
|
@ -70,8 +70,8 @@ export default class LhispOauthClient {
|
|||
|
||||
isTokenValid(token: AccessToken){
|
||||
if(!token) return false;
|
||||
const now = Date.now()
|
||||
const timeDiff = (now - token.created_at) / 1000;
|
||||
if(!token.created_at) return false;
|
||||
const timeDiff = (Date.now() - token.created_at) / 1000;
|
||||
return timeDiff < token.expires_in - 10;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue