chatengine-io / react-chat-engine

React component for a cheap and easy chat API
138 stars 35 forks source link

getOrCreateChat Need Help #124

Open vrrock opened 2 years ago

vrrock commented 2 years ago

Hi, I have an issue with getOrCreate chat. So basically, I have this piece of code here that has data, and my headers below which store current user credentials.

 const [headers, setHeaders] = useState({
    'Project-ID': 'project_id_number',
    'User-Name': {buyerName},
    'User-Secret': "nope",
  })

  const data = {
    "usernames": [buyerName, res.data.firstName],
    "is_direct_chat": true
  }

  console.log(data)
  getOrCreateChat(headers, data, chat => setChat(chat))

This is similar to the marketplace case but when I run this, I get a 403 error which means I am still unauthorized to getOrCreateChat. Can you help me out? I am just trying to create a chat between two users, knowing the current user's credentials and the username of the current user and other user.

Would appreciate help with this as soon as possible!:)