简体   繁体   中英

You must specify a valid JavaScript API Domain

I need some help with the LinkedIn API. I'm getting the following error:

Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration.

But I already add my domain to the Javascript SDK Domains. My domain is the next one:

http://is01.inthegra-app.com.ar:8083/apex/

LinkedIn take it as a valid one but I still having the same error. The code in my page is this one:

<script type="text/javascript" src="//platform.linkedin.com/in.js">
  api_key: API_KEY_HERE;
  onLoad: onLinkedInLoad;
  authorize: true;
</script>
<script type="text/javascript">
    function mandoMensaje(){
        onLinkedInLoad();
    }

   function onLinkedInLoad() {
      IN.Event.on(IN, "auth", shareContent);
    }

    function onSuccess(data) {
      console.log(data);
    }

    function onError(error) {
      console.log(error);
    }

    function shareContent() {
            var payload = {
            "Content-Type": "application/json",
            "x-li-format": "json",
            "comment": "Hello world...",
            "content": {
                "title": "LinkedIn API Test",
                "description": "Publish in LinkedIn from HTML and JavaScript",
                "submitted-url": "http://www.inthegra.com.ar",  
                "submitted-image-url": "http://www.inthegra.com.ar/img/logo-inthegra-blanco.png"
            },
           "visibility": {
               "code": "anyone"
           }  
      };
      IN.API.Raw("/people/~/shares?format=json")
     .method("POST")
     .body(JSON.stringify(payload))
     .result(onSuccess)
     .error(onError);
  }
</script>

/apex/ is not part of the hostname/domain and port that your Javascript is being executed from. Try removing that portion of the value in your application's configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM