update api response

This commit is contained in:
wodka 2019-09-10 23:29:08 +02:00
parent 1e0f82d257
commit 6641455ef2
3 changed files with 15 additions and 18 deletions

View File

@ -2,9 +2,8 @@ import { ApiModelProperty } from '@nestjs/swagger';
export class AuthJwtDto {
@ApiModelProperty()
token: {
accessToken: string;
accessToken: string;
refreshToken: string;
}
@ApiModelProperty()
refreshToken: string;
}

View File

@ -54,19 +54,17 @@ export class AuthService {
scope: user.roles,
};
return {
token: {
accessToken: this.jwtService.sign(payload),
// TODO add refresh token invalidation uppon usage! They should only work once
refreshToken: this.jwtService.sign(
{
...payload,
refresh: true
},
{
expiresIn: '30days',
}
),
}
accessToken: this.jwtService.sign(payload),
// TODO add refresh token invalidation uppon usage! They should only work once
refreshToken: this.jwtService.sign(
{
...payload,
refresh: true
},
{
expiresIn: '30days',
}
),
};
}
}

View File

@ -32,7 +32,7 @@ export default {
strategies: {
local: {
endpoints: {
login: { url: '/api/auth/login', method: 'post', propertyName: 'token.accessToken' },
login: { url: '/api/auth/login', method: 'post', propertyName: 'accessToken' },
logout: { url: '/api/auth/logout', method: 'post' },
user: false
},