Skip to main content
Inspiring
Nov 19, 2020 4:21 PM UTC
Answered

BUG - Cannot connect to Embed API with API Key

Hello,

 

I activated the Embed API and, I think, I followed the instructions but it still not working.

 

When trying to access to the API with the key, I receive this:

 

This application domain (https://staging-ilha.herokuapp.com) is not authorized to use the provided PDF Embed API Client ID.

 

However, here is my setup:

 

 

I don't get what's going wrong 🙂

 

The error:

 

 

Thanks a lot !

Gordon

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Gordon5F8ECorrect answer
    Inspiring
    Nov 19, 2020 10:03 PM UTC

    I haven't used React. Can you try the clientId with vanilla JS just to determine if it's the React code or a bad id?


    The problem is fixed.

    It was indeed a problem with the API KEY.
    I did enabled another API in the same project, so the API was requesting me to send a JWT.
    A created a separate project for this API and now it's working 🙂

    Thx for the help

    10 replies

    Joel Geraci
    Community Expert
    Community Expert
    Nov 19, 2020 4:42 PM UTC

    Can you supply the full JavaScript and HTML you are using?

    Translate
    Inspiring
    Nov 19, 2020 4:48 PM UTC

    Yes sure, 

     

    I'm using the React sample.

    previewFile(divId, viewerConfig, fileUrl, meta) {
            const config = {
                /* Pass your registered client id */
                clientId: process.env.REACT_APP_ADOBE_KEY,
            };

     

    Where my .env is returning the API_KEY

     

    And for the HTML I added 2 scripts in the doc where the React APP is rendered.

     

      <head>
        <meta charset="utf-8" />
        <link rel="icon" type="image/png" href="%PUBLIC_URL%/favicon-196x196.png" sizes="196x196" />
        <link rel="icon" type="image/png" href="%PUBLIC_URL%/favicon-128.png" sizes="128x128" />
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="%PUBLIC_URL%/apple-touch-icon-152x152.png" />
        <script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
        <script src="https://documentcloud.adobe.com/view-sdk/2.10.3_1.10.0-1e3411b/ViewSDKInterface.js"></script>
    
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta name="theme-color" content="#000000" />
        <meta
          name="description"
          content="ILHA is an online musical school made by passionate artists.
          We're a community that loves music and connecting people."
        />

     

    It locally woarks on local host when using the API_KEY provided with the REACT sample.

     

    Thanks 🙂 

    Translate
    Inspiring
    Nov 19, 2020 4:52 PM UTC

    Sorry, just realized that the error screenshot wasn't correct.

    Here is the good one. Sorry again

     

    Translate