Photon Chat JavaScript SDK custom authentication

I have a free plan chat app registered in Photon dashboard. I want to use custom authentication service. And when I try to authenticate with an object:

const type = Photon.LoadBalancing.Constants.CustomAuthenticationType.Custom;
chatClient.setCustomAuthentication('', type, {
 '(string)message': 'some_data',
 '(string)signature': 'some_other_data'
});

Photon SDK gives me this error:

Client: Error: 3101 NameServer authentication failed: 32755 Authentication data type not supported

When I send regular string (or JSON object string) I don't see any errors related to data format. But this data is not being passed in request body to my server (POST request works itself). Photon chat SDK says, that I can provide raw JS object and it will get passed in `application/json` format when sending POST request to the authentication endpoint. Can you help me with this issue?

Comments

  • Hi @rjkz808,

    Thank you for choosing Photon!

    It looks like JSON object as custom authentication payload is not fully supported yet or broken in JavaScript SDK.
    We will investigate and see if this will be fixed.
    This could take time as it may require some server-side adjustments.

    If you can get around this by using stringified JSON string it would unblock the situation for you.
    If this is not possible let us know.
  • rjkz808rjkz808
    edited December 4
    Hi! I figured out that parameters for authentication provider can only be passed in URL query. Stringified JSON is not being added to request body when I receive it on my web server
  • Hi @rjkz808,

    Maybe there is an issue with the JavaScript/TypeScript implementation but the API supports HTTP POST with payload. It just needs to be not null nor empty.
  • JohnTube said:

    Hi @rjkz808,

    Maybe there is an issue with the JavaScript/TypeScript implementation but the API supports HTTP POST with payload. It just needs to be not null nor empty.

    So, will it be fixed in JavaScript/TypeScript SDK?
  • checking with the team
Sign In or Register to comment.