Getting 401 unauthorized error for embedded app

I have created an app using Retool and tried to embed it in a Next JS web app. When I try to embed it in the web app, it throws an unauthorized error. I'm in a free plan in Retool, will that be a problem? I have added the server-side code that we followed from Embed a web app with Retool Embed | Retool Docs

const payload = { 
        'landingPageUuid': 'xxxx-xxx-xxx',
        'groupIds': [xxxxx],
        'externalIdentifier': (reqData.accessToken).split(".")[2],
        'userInfo': {
            'firstName': "Sankar",
            'lastName': "M",
            'email': "xxx@xxx.xxx",
          }
    };
    console.log("payload : ", payload)
    const res = await fetch(`https://xxx.retool.com/api/embed-url/external-user`, {
        method: 'POST',
        headers: {
            'Authorization': `Bearer retool_xxxxxxx`,
            'Content-type': 'application/json',
        },
        body: JSON.stringify(payload),
    })
    let data = null
    if(res.ok){
        data = await res.json()
        console.log("data : ",data)
    }else{
        console.log(res)
        data = {message:"error"}
    }

Please help me to resolve this ASAP.

Embed a web app with Retool Embed

1 Like

Facing the same issue. Let me know if you find a fix

@Ranveer_Shah @Sankar_Mahadevan It's is available for Business and Enterprise plans only:

If you don't see this "Available on" section right under the title, then it's available for all plans including the free one. Here's an example of one that all plans can use so you can see the difference:

it could be highlighted a bit better, here're a few ideas that would have helped me out also with figuring out which features are supported by which plans.
There's a poll also, just cause it seems like the most opportune time to include/use one for the first time (for a valid reason, not just funsies).

  • Underline
  • Bounding box
  • Filled background
  • There are other better options
  • It's fine the way it is
0 voters

If it is only for paid plans, how can the new users test this feature and do a demo? Not satisfied with this restriction. At least it should provide a trial period to test different features.

for reference, this is one of a few ways to embed a retool webapp. You could also try using the iframe embed (below) or the react-retool js lib here

you can find the iframe code from the Share link found in the top right corner
image

it'll open a window similar (or the same) as this:
image

just click the </> Copy embed code link, not the blue button (which copies the url listed above it, the url is slightly different than what the iframe uses)
the blue button will give something like:
https://yourretoolaccount.retool.com/apps/uuid-35567-23423/appname

where the 'Copy embed code' link gives (you'll notice the missing uuid):
<iframe src="https://yourretoolaccount.retool.com/apps/appname" width="100%" height="800px">

1 Like

My company is having a business plan

Could You take a look at my post facing the same issue

https://community.retool.com/t/getting-401-unauthorized-for-embedding-apps-using-postman/31902