JavaRush-GNEW / JavaRush-GNEW/new-contact-manager

[FR] 401 Status code for unauthorized requests

Open
#46 0 comments 0 reactions 1 assignee Claimed by @hrsweetlana View on GitHub
enhancement
Dominant language
Java
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Description
Please, make sure that any /api/* request that requires a valid token send a response status code 401 when the token is not valid.

https://developer.mozilla.org/de/docs/Web/HTTP/Reference/Status/401

For example, this should return 401 Unauthorized

```http
POST /api/v1/contact-book HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Cookie: JSESSIONID=5CF4C511B6EC8A9358B89B18A3E7F278
Content-Length: 566

{
"name": "My contacts",
"contacts": [
{
"name": "Alice",
"lastName": "Smith",
"emails": [
{"email": "alice@example.com"}
],
"phones": [
{"phone": "+380501112233"}
],
"networks": [
{"label": "telegram", "account": "@alice_ua"}
]
},
{
"name": "Bob Johnson",
"emails": [
{"email": "bob@example.com"}
],
"phones": [
{"phone": "+380671234567"}
],
"networks": [
{"label": "facebook", "account": "bob.j"}
]
}
]
}
```

## Dependencies

-

## Acceptance criteria
1. 401 status code is returned when the token is not valid
2. No redirects to the main page
3. Message "Unauthorized request" is returned.

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.