Skip to content

[FR] 401 Status code for unauthorized requests #46

@oleksandr-jr

Description

@oleksandr-jr

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

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions