A session is the only way to authenticate WebSocket connection.
Please provide full response details from when you did POST/GET to the session API, including headers.
And also the request with headers.
Firstly I did a POST request to: <server>/api/session (with Postman)
with headers: Cookie JESSIONID VALUE: node015feh....
Authorization as basic auth (username and password)
and with form-urlencoded body that contains the email and password.
and received a response shown below.
Status: 200 OK
Body:
Note: some values are replaced with <Name>
{
"id": 3,
"attributes": {},
"name": "test",
"login": null,
"email": <MY_EMAIL>,
"phone": null,
"readonly": false,
"administrator": true,
"map": null,
"latitude": <MY_LAT>,
"longitude": <MY_LONG>,
"zoom": 0,
"twelveHourFormat": false,
"coordinateFormat": null,
"disabled": false,
"expirationTime": null,
"deviceLimit": -1,
"userLimit": 0,
"deviceReadonly": false,
"limitCommands": false,
"disableReports": false,
"fixedEmail": false,
"poiLayer": null,
"password": null
}
Cookies:
Name: JESSIONID Value: node015feh....
Headers:
Date
Content-Type
access-control..
Content-Length
Server
So you already have the session:
NAME: JESSIONID VALUE: node015feh....
Please in the future don't use all-caps. Makes it really hard to read and doesn't help anyone.
I have the session but tried it and did not work.
I tried /api/session?token=<Value>
My bad, just edited the message and the all-caps text, sorry I typed the message quickly.
That's a session id. Why are you using as an access token?
How can I create an access token ?
Sorry I am confused, how can I deal with the websocket exactly to start authenticating and establishing websocket connection between the client app and the web app server?
Are you asking about about access token or the session id (aka session token)?
I am asking about the one needed for starting a websocket connection.
That's the session id cookie. That's what you need and you already have it.
Thanks ! I really appreciate your responses and efforts.
Can you provide me with a doc or guide me on how can I start making a websocket connection between the client and the web app server to send data for each client app.
Can I know the websocket endpoint?
Hello,
Thanks for the amazing efforts.
To deal with the websocket we have to include sessions token, right ? There's no other way to deal with the websocket, no?
I tried post and get methods for the session api to but did not receive a token in the response message or headers.
Also, I am trying to deal with the websocket between the client app and the web app server and could not find a specific doc for that. I am using socketio to perform the websocket connection between the two but was not able to find details on how to deal with such a thing to emit client data to the server.
Thanks again!