parent
c33097f773
commit
a0fe8c0017
@ -33,20 +33,20 @@ export class CreateAuth {
|
|||||||
} else {
|
} else {
|
||||||
const found_user = found_users[0]
|
const found_user = found_users[0]
|
||||||
if (await argon2.verify(found_user.password, this.password + found_user.uuid)) {
|
if (await argon2.verify(found_user.password, this.password + found_user.uuid)) {
|
||||||
// TODO: proper jwt creation
|
|
||||||
const timestamp_accesstoken_expiry = Math.floor(Date.now() / 1000) + 5 * 60
|
const timestamp_accesstoken_expiry = Math.floor(Date.now() / 1000) + 5 * 60
|
||||||
|
delete found_user.password;
|
||||||
newAuth.access_token = jsonwebtoken.sign({
|
newAuth.access_token = jsonwebtoken.sign({
|
||||||
refreshtokencount: 5,
|
userdetails: found_user,
|
||||||
userdetails: {},
|
|
||||||
exp: timestamp_accesstoken_expiry
|
exp: timestamp_accesstoken_expiry
|
||||||
}, "securekey")
|
}, "securekey")
|
||||||
|
newAuth.access_token_expires_at = timestamp_accesstoken_expiry
|
||||||
|
//
|
||||||
const timestamp_refresh_expiry = Math.floor(Date.now() / 1000) + 10 * 36000
|
const timestamp_refresh_expiry = Math.floor(Date.now() / 1000) + 10 * 36000
|
||||||
newAuth.refresh_token = jsonwebtoken.sign({
|
newAuth.refresh_token = jsonwebtoken.sign({
|
||||||
refreshtokencount: 5,
|
refreshtokencount: 5,
|
||||||
userdetails: {},
|
userid: found_user.id,
|
||||||
exp: timestamp_refresh_expiry
|
exp: timestamp_refresh_expiry
|
||||||
}, "securekey")
|
}, "securekey")
|
||||||
newAuth.access_token_expires_at = timestamp_accesstoken_expiry
|
|
||||||
newAuth.refresh_token_expires_at = timestamp_refresh_expiry
|
newAuth.refresh_token_expires_at = timestamp_refresh_expiry
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidCredentialsError()
|
throw new InvalidCredentialsError()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user