I’m trying to creating to create ASCClient
with the following code - but I’m getting error 401
unauthorized error
import ASCClient, { ConnectionStatus } from "@amityco/js-sdk";
// Amity sample-app apiKey
const apiKey = "MY API KEY";
export const client = ASCClient.create({ apiKey });
export let currentUserId = null;
// promisified client connection
export const connectClient = async (userId) => {
return new Promise((resolve) => {
client.on("connectionStatusChanged", ({ newValue }) => {
console.log(newValue);
if (newValue === ConnectionStatus.Connected) {
currentUserId = userId;
resolve();
}
});
client.on("dataError", (err) => console.log(err));
client.registerSession({ userId });
});
};