Skip to content

Instantly share code, notes, and snippets.

@sendbird-community
Created March 17, 2023 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sendbird-community/201d5ba2b8d53ccca1258643fde6d74a to your computer and use it in GitHub Desktop.
Save sendbird-community/201d5ba2b8d53ccca1258643fde6d74a to your computer and use it in GitHub Desktop.
Fetch the user credentials
const fetchSendbirdUserCredentials = async (sendbirdUserId) => {
try {
//Get Agents user details from Sendbird
const data = await client.request.invoke("getAgentsSendbirdCreds", { sendbirdUserId })
//Attached agents's sendbird access_token to the data to be passed to the modal.
return { sendbirdUserId, access_token: JSON.parse(data.response.response).access_token }
} catch (e) {
console.log(e.message)
throw Error(e)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment