ConnectyCube / connectycube-reactnative-samples

Chat and Video Chat code samples for React Native, ConnectyCube
https://connectycube.com
Apache License 2.0
124 stars 111 forks source link

error logging in returns 401 unauthorized access #186

Closed pooja-9spl closed 3 years ago

pooja-9spl commented 3 years ago

While login in - POST https://api.connectycube.com/session.json - returns 401 not always but sometimes.

I have setup config(appId, authKey, authSecret). Then login with user credentials that I have already setup in connectycube admin panel.

In some cases it returns 401 and sometimes it logging in successfully.

I have used below auth-service code in my project. Please find it for reference: https://github.com/ConnectyCube/connectycube-web-samples/blob/master/chat/src/services/auth-service.js

DaveLomber commented 3 years ago

could you please post the exact server request & response log

Here is how to enable logs. https://github.com/ConnectyCube/connectycube-reactnative-samples/blob/master/RNChat/config.json#L16

pooja-9spl commented 3 years ago

Sure, Please find below my request payload:

POST | https://api.connectycube.com/session.json { "application_id":"**", "auth_key":"Kjf9R5wE83***", "nonce":921, "timestamp":1609927733, "user":{"login":"pooja.shah@9spl.com","password":"Test105*"}, "signature":"f0481d512ed2d4d66f4de8793f9ce42cb8881e8f" }

And below in response log that I got:

{ "errors":["Unauthorized"] }

with status 401 Unauthorized

DaveLomber commented 3 years ago

Is this a user login and not email? Cause it looks like an email

pooja-9spl commented 3 years ago

Yes, this is user login, just that I have used my email address as username.

DaveLomber commented 3 years ago

It's either wrong password or login provided

or encoding issue, e.g. with @ char

could you please try diff user and let me know if it works

We need to find the diff and then root cause

pooja-9spl commented 3 years ago

There are several users in our project that faces this issue. And It should not be the case of encoding characters as I have some users with email addresses and that works fine.