Closed swhiber closed 6 years ago
Looks like your Auth Pusher server is not returning the correct data to your ChatKit client.
Using express 4.x you can this in your Node.Js server:
const auth = chatkit.authenticate({
userId: user_id, // your app user id
authPayload: req.body,
});
return res.json(auth.body);
See also this example: https://github.com/pusher/chatkit-server-node/blob/master/examples/auth_server.js
So my server is returning a valid access_token, however the error states there is a 'Missing token subject' so I'm wondering whether I have to add anymore headers? Thanks for responding, here are my headers at the moment (same as in first post)
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer '+btoa(this.state.accessToken)
}
A missing subject means that there's no sub
claim in the token that is being generated. We use the sub
(subject) claim to store the user's ID, so it sounds like you're not providing a user ID when you generate your token(s).
It was to do with the user_id! Thanks a lot for your help
I've been trying to add a new room via a request to my server
However I receive this error
error: 'services/chatkit_authorizer/authorization/invalid_token_subject', error_description: 'Missing token subject', error_uri: 'https://docs.pusher.com/errors/services/chatkit_authorizer/authorization/invalid_token_subject'
I'm unsure if I'm making a silly error or whether there is an issue with SDK. Some more documentation on the topic would probably resolve this either way :)