Unable to get Embeds working on production!

Hi Team,

I am unable to get the embeds to work on production somehow.

I can successfully get a response and the embedUrl from the javascript function on local testing, but when I push it to production it returns me a Unauthorized error.

Response on local:

Response on production:

I have a business plan for EkLine, and have configured the custom domains.

Can someone help here.

Hey,

Sorry this isn't working well in your production environment. The only time we'll return unauthorized here is when your bearer token doesn't match a valid embed API token. Without knowing more about how you're deploying the parent app that's calling embed it's hard for me to say why those aren't matching. But a possibility is that the token isn't being set appropriately in your production environment.

Note that for security this should be called from a backend environment, not a frontend application running in the browser.

If you'd prefer to discuss the specifics of your setup directly I'm sending you a message on the forum with my email.

Thanks @lukew. These are good pointers.

We use next.js to deploy the application, and I wonder if we need to move this API call to the BE. Though I doubt if this is the problem, as this works well on local system.

Also, I should probably confirm the bearer token with the embed API token.

I will give this a try, and let you know. Thanks

I wonder if we need to move this API call to the BE

Generally yes, you should. Of particular importance is that your private API keys may be visible if you're calling this from the frontend.

Fixed the problem. I was hitting http instead of https