Skip to content

Instantly share code, notes, and snippets.

@nemo0
Created May 28, 2023 07:35
Show Gist options
  • Save nemo0/9201496ceff257707bb4ec8afc00c9ad to your computer and use it in GitHub Desktop.
Save nemo0/9201496ceff257707bb4ec8afc00c9ad to your computer and use it in GitHub Desktop.
Call.js Authenticate Function
const authenticate = async () => {
try {
const result = await new Promise((resolve, reject) => {
SendBirdCall.authenticate({ userId }, (res, error) => {
if (error) {
reject(error);
} else {
resolve(res);
}
});
});
console.log(`Authenticated as ${userId}`);
return result;
} catch (error) {
console.log('Error authenticating');
throw error;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment