I am using the django client getstream.io. My backend code is as follows: it generates a read-only token and saves it in response using my jwt token, which is sent when the login is successful. This code is at the bottom of my settings.py file, which contains the STREAM_API_SECRET and STREAM_API_KEY parameters. They are also in my .py settings and correspond to what is in my getstream.io control panel.
from stream_django.client import stream_client
def jwt_response_payload_handler(token, user=None, request=None):
user_feed_1 = stream_client.feed('user', str(user.id))
readonly_token = user_feed_1.get_readonly_token()
return {
'token': token,
'stream': str(readonly_token)
}
In the interface, the token is correctly obtained from the response to the input, which contains the stream token. It tries to configure the stream in real time, but when it connects, I get a "Error without authentication" message. I confirmed that the token passed to the next side of the client function corresponds to the token indicated above.
function setupStream (token, id) {
var client = stream.connect(STREAM_API_KEY, null, STREAM_APP_ID)
var user1 = client.feed('user', id, token)
function callback (data) {
console.log(data)
}
function failCallback (data) {
alert('something went wrong, check the console logs')
console.log(data)
}
user1.subscribe(callback).then(() => {}, failCallback)
}
I'm not sure what I'm doing wrong, because as far as I can tell, everything is set up correctly. Tokens and user ID correspond to what is on the front panel and backend.
I am following what is in the documentation but not working:
https://getstream.io/docs/#readonly-tokens
When I tried to use only the console:
user1.get({ limit: 5, offset: 0 })
.then(callback)
.catch(failCallback)
The exact body of the error response I get from this:
{
"code": null,
"detail": "url signature missing or invalid",
"duration": "7ms",
"exception": "AuthenticationFailed",
"status_code": 403
}
EDIT:
, :
get_readonly_token() .token, /, . readonly?