/api/session unable to GET with Standard HTTP authorization header

PG10 months ago

Using the following on my server:

GET /api/session HTTP/1.1
Authorization: Basic base64_encoded
Host: www.example_domain.com
Accept: application/json

Response:

HTTP/1.1 404 Not Found
Date: Sun, 03 Mar 2024 05:13:53 GMT
Server: Jetty(11.0.19)
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json
access-control-allow-headers: origin, content-type, accept, authorization
access-control-allow-credentials: true
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
Content-Length: 97
Set-Cookie: JSESSIONID=node0....node0; Path=/

I made sure that I am using the username and password to create the base 64 encoded authorization.
When I use a token, it works.

https://www.traccar.org/traccar-api/ states that I can use "Standard HTTP authorization header."

Anton Tananaev10 months ago

That's not how it works. If you want to use session, you should do a login.

PG10 months ago

Ok, so I should login, then GET the session?

Anton Tananaev10 months ago

Yes.