luceroweb / luceroweb/cineflix

[BUG]: Auth Bearer Token error not returned correctly

Open
#2 0 comments 0 reactions 1 assignee View on GitHub

@luceroweb is already working on this.

Since Aug 13, 2023.

bug
Dominant language
JavaScript
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce:
- Run POST `api/v1/movies` without Auth Bearer Token
- Body:
```
{
"name": "ABCD",
"description": "A veteran pot dealer creates a fake family as pat of his plan to move a hige shipment of weed into the U.S. from Mexico.",
"ratings": 10,
"totalRating": 230,
"releaseYear": 2013,
"releaseDate": "2013-08-03T00:00:00Z",
"genres": [
"Comedy",
"Crime"
],
"directors": [ "Rawson Marshal Thurber" ],
"coverImage": "we-are-the-millers-2013.jpg",
"actors": [
"Jason Sukeikis",
"Jennifer Aniston",
"Emma Doborte"
],
"price": 48,
"duration": 120
}
```

Actual result:
```
JsonWebTokenError: jwt must be provided
at module.exports (C:\Users\Juan Clark-Lucero\OneDrive\Documents\nodejs-course\cineflix\node_modules\jsonwebtoken\verify.js:60:17)
at node:internal/util:378:7
at new Promise ()
at node:internal/util:364:12
at C:\Users\Juan Clark-Lucero\OneDrive\Documents\nodejs-course\cineflix\Controllers\authController.js:74:56
at C:\Users\Juan Clark-Lucero\OneDrive\Documents\nodejs-course\cineflix\Utils\asyncErrorHandler.js:3:5
at Layer.handle [as handle_request] (C:\Users\Juan Clark-Lucero\OneDrive\Documents\nodejs-course\cineflix\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\Juan Clark-Lucero\OneDrive\Documents\nodejs-course\cineflix\node_modules\express\lib\router\route.js:144:13)
at next (C:\Users\Juan Clark-Lucero\OneDrive\Documents\nodejs-course\cineflix\node_modules\express\lib\router\route.js:140:7)
at Route.dispatch (C:\Users\Juan Clark-Lucero\OneDrive\Documents\nodejs-course\cineflix\node_modules\express\lib\router\route.js:114:3)
```

Expected Result:
```
{
"status": "fail",
"message": "You are not logged in!"
}
```

Reported by: @luceroweb

Source URL: PATCH `api/v1/movies`

Browser: Postman v10.17.1
OS: Windows 11 Home
Node: v19.4.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.