Embedded url requesting user to login

Hello :wave:,

I am requesting an embed URL using this method.
I am able to retrieve a URL without problems. That URL works fine.

Now I am trying to embed my URL in my external app using the first javascript snippet in this page.

Authentification is already handled in my external app. So when I am requesting the embed URL, the user is authenticated.

The problem is that my embed throws a console error 401. The interface displays: "error: unauthorized" and then displays the retool log-in page which I don't want.

How can I have the app displayed in my external app without additional authentication?

Thanks

Hi @lukew,

is my setup supposed to work?

Thanks

You're likely getting a 401 due to reusing the generated URL, either directly or because your parent application is requesting it repeatedly. Embed URLs are one-time use based on the included nonce. Once they are loaded you will need to generate a new one from the first part.

I am requesting a new URL for every user connection to my app. So URLs are not reused.

I don't understand what you mean by:

Embed URLs are one-time use based on the included nonce. Once they are loaded you will need to generate a new one from the first part.

Could you elaborate on that?

Thank you !!

Ah, I just noticed that your second link is to public apps. These are different than embed.

The docs for using the embed url are here. They're specific to React, but generally you just want to create an iframe with the URL provided by the API call.

I am requesting a new URL for every user connection to my app. So URLs are not reused.

Embed URLs are one-time use based on the included nonce. Once they are loaded you will need to generate a new one from the first part
Could you elaborate on that?

Sure, though I'm not sure this is what's causing the issue as if you're using the public apps SDK with an embed URL that's not supported behavior.

Basically each time you generate an embed URL it includes a one-time-use string, so if you've previously hit that URL either within the same user session (due to a page reload, react component rerender, etc) it will be invalid and you'll need to generate a new URL for that user.