pusher / chatkit-server-php

PHP SDK for Pusher Chatkit
https://pusher.com/chatkit
MIT License
35 stars 20 forks source link

Examle authorization #10

Closed alexey13 closed 6 years ago

alexey13 commented 6 years ago

Good day! What kind of url should be in tokenprovider? Would appreciate for examples. Cant understand how to generate tokens and send them in header.

alexey13 commented 6 years ago

Problem was in id. In wordpress its a number. It would be great to support numbers as id.

hamchapman commented 6 years ago

Hey @alexey13 thanks for the feedback.

Making authentication and authorization clearer is something that's high up on our backlog.

I'm glad you managed to figure it out (and sorry for the hassle!).

Just to be clear, were you making a call to generateTokenPair with a number as the id?

It could be that we could throw an error if the user ID provided to the call isn't a string.

alexey13 commented 6 years ago

Yes. I tried to generateTokenPair with a number as the id and got 403 error (forbidden), thats why i thought problem with tokenprovider url or with something else.

hamchapman commented 6 years ago

@alexey13 we've made a change on the server so that you'll get a nice error back like this:

{
  "error": "services/chatkit/unprocessable_entity/validation_failed",
  "error_description": "Expected `id` to be of type string but got number",
  "error_uri": "https://docs.pusher.com/errors/services/chatkit/unprocessable_entity/validation_failed"
}