You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I follow the instructions provided on the docs folder of the nestjs-angular bundle to test the api using <api_url>/swagger. First I made a POST to /api/auth/login and got a token. I then set the authorization by the button located on the top right of the page using the format Bearer <token>.
All the attempts to access locked paths on the api returned me error 401 - Unauthorized with the body:
{
"statusCode": 401,
"error": "Unauthorized"
}
Analyzing the post, swagger was sending on the header of my requests with the key Authentication: Bearer <my-token>. I believe the correct is Authorization: Bearer <my-token>.
I changed .addBearerAuth('Authentication', 'header') to .addBearerAuth('Authorization', 'header') on the main.ts from the backend project and got it working.
The text was updated successfully, but these errors were encountered:
I follow the instructions provided on the docs folder of the nestjs-angular bundle to test the api using
<api_url>/swagger
. First I made a POST to/api/auth/login
and got a token. I then set the authorization by the button located on the top right of the page using the formatBearer <token>
.All the attempts to access locked paths on the api returned me error 401 - Unauthorized with the body:
Analyzing the post, swagger was sending on the header of my requests with the key
Authentication: Bearer <my-token>
. I believe the correct isAuthorization: Bearer <my-token>
.I changed
.addBearerAuth('Authentication', 'header')
to.addBearerAuth('Authorization', 'header')
on themain.ts
from the backend project and got it working.The text was updated successfully, but these errors were encountered: