Why does OV /api/tokens/ return a Websocket URI for 'token'?

This is the sample return data for a valid POST to /api/tokens:

{
  "id": "wss://localhost:4443?sessionId=zfgmthb8jl9uellk&token=lnlrtnkwm4v8l7uc&role=PUBLISHER&turnUsername=FYYNRC&turnCredential=yfxxs3",
  "session": "zfgmthb8jl9uellk",
  "role": "PUBLISHER",
  "data": "User Data",
  "token": "wss://localhost:4443?sessionId=zfgmthb8jl9uellk&token=lnlrtnkwm4v8l7uc&role=PUBLISHER&turnUsername=FYYNRC&turnCredential=yfxxs3",
  "kurentoOptions": {
    "videoMaxSendBandwidth": 700,
    "allowedFilters": [
      "GStreamerFilter",
      "ZBarFilter"
    ]
  }
}

The token is embedded inside a websocket URI called, 'token'. It seems like this should be 'wssUri' and a separate parameter should be given for 'token' which is in the above example, lnlrtnkwm4v8l7uc.

While I have not fully implemented OV yet, I had expected I would need to be handling the token directly.

For example, in the openvidu-call-react app it uses the actual token string to make the connection to the session.

I’m not sure how to provide that to the frontend without first parsing the URI into components to get at that string.

Perhaps I’m missing something here. Is there a reason the token is only returned as a bundled parameter of a websocket URI?

Token structure is not relevant. Token is not really just the random string you see inside “id” and “token” properties, it is all of the string, that happens to have a URL format.
You don’t have to do anything with the string returned by REST API. You just provide it as it is to Session.connect method.

I see. I had thought it was only the substring token. Thanks for this feedback.