akveo / akveo/ngx-admin-bundle-support

Unauthorized requests on swagger

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
56
Forks
30
PR merge metrics
No merged PRs in 30d

Description

I follow the instructions provided on the docs folder of the nestjs-angular bundle to test the api using `/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 `.

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 `. I believe the correct is `Authorization: Bearer `.

I changed `.addBearerAuth('Authentication', 'header')` to `.addBearerAuth('Authorization', 'header')` on the `main.ts` from the backend project and got it working.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.