ConnectyCube / connectycube-reactnative-samples

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

Error 422 "Bad Authentication data" after updating to SDK v2.1.6 #68

Closed whenmoon closed 4 years ago

whenmoon commented 4 years ago

I have up just updated from SDK v1.83.4 to v2.1.6 and cannot log in. I am getting this response:

Bad Authentication data. Invalid input parameters provided: no 'firebase_phone[access_token]' and 'firebase_phone[project_id]' parameters provided

I am providing the correct data including 'firebase_phone[access_token]' and 'firebase_phone[project_id]' in the userCredentials object just as I was previously. I have changed the syntax however to JDK v2 syntax:

const userCredentials = {
  provider: 'firebase_phone',
  'firebase_phone[project_id]': "xyz",
  'firebase_phone[access_token]': accessToken,
};

export const logInToConnectycube = userCredentials => {
  console.log(userCredentials); // everything is present and correct
  return ConnectyCube.login(userCredentials)
    .then(user => user)
    .catch(error => error);
}

A session has already successfully been created:

export const createConnectyCubeSession = () => {
  return ConnectyCube.createSession()
    .then(session => session)
    .catch(error => error);
} 

I get the same error with SDK v 3.0.1.

DaveLomber commented 4 years ago

Does passing this as object work?

"firebase_phone": {"project_id": "..." , "access_token": ".."}

whenmoon commented 4 years ago

Yes that worked thank you @DaveLomber!