Discussions
401 Unauthorized access (https://api.heygen.com/v1/streaming.task)
Hi, I'm building a web application where I'm trying to call the Initialize the avatar (with my trail token and access token) and make it speak the custom text through below handleSpeak() function call
async function handleSpeak() {
if (!initialized || !avatar.current) {
setDebug("Avatar API not initialized");
return;
}
await avatar.current
.speak({
taskRequest: {
text: "Hello World",
sessionId: data?.sessionId,
},
})
.catch((e) => {
setDebug(e.message);
});
}
The avatar is getting successfully getting intialize'd but when I do hit on handleSpeak() function to make it speak a custom text, it is throwing the below error.
Request URL: https://api.heygen.com/v1/streaming.task
Request Method: POST
Status Code: 401 Unauthorized
Remote Address: 18.222.6.41:443
Referrer Policy: strict-origin-when-cross-origin