@next-nest-auth/nestauth 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/nestauth.controller.ts +4 -0
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ To test if the installation is successful, call POST -> `http://localhost:3000/n
|
|
|
105
105
|
|
|
106
106
|
### 6 Refresh tokens
|
|
107
107
|
|
|
108
|
-
To refresh your token call
|
|
108
|
+
To refresh your token call POST -> `http://localhost:3000/nestauth/refresh-token` with your params `refresh_token` with value `your-refresh-token`
|
|
109
109
|
|
|
110
110
|
#### On Success
|
|
111
111
|
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
HttpStatus,
|
|
10
10
|
All,
|
|
11
11
|
UseFilters,
|
|
12
|
+
BadRequestException,
|
|
12
13
|
} from "@nestjs/common";
|
|
13
14
|
import { NestAuthService } from "./nestauth.service";
|
|
14
15
|
import { NestAuthLocalGuard } from "./nestauth-local.guard";
|
|
@@ -34,6 +35,9 @@ export class NestAuthController {
|
|
|
34
35
|
|
|
35
36
|
@Post("refresh-token")
|
|
36
37
|
refreshToken(@Body() params: { refresh_token: string }): Promise<any> {
|
|
38
|
+
if (!params.refresh_token) {
|
|
39
|
+
throw new BadRequestException("Invalid or expired refresh token");
|
|
40
|
+
}
|
|
37
41
|
return this.nestAuthService.refreshToken(params.refresh_token);
|
|
38
42
|
}
|
|
39
43
|
|