LinkedIn Developer API Javascript Domains for Cordova Mobile App

I was starting a small project making a mobile app using Apache Cordova (PhoneGap) to pull data from LinkedIn. The first step I did was signing up for LinkedIn’s Developer program so that I could obtain an API key.

When filling out the requested information, one of the items threw me for a loop – “Javascript API Domains” which was described as a “Comma separated list of fully-qualified domain name of all pages that will call the JavaScript API. Only needed if using Javascript API. Must include protocol, host, and port (it not 80 or 443).”

While this is a typical question when you are asking a web developer, this would be http://localhost if you are developing locally or simply http://yourdomain if you were hosting it. However, I wasn’t sure how it applied to mobile, and specifically in the case of Cordova.

I initially tried “http://localhost” but received the following error being thrown in LogCat:

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

After searching around I was able to find other people asking similar questions, however I was unable to find any answers.

It wasn’t until I noticed the following line in the logs did I realise what I should provide as the API Domain.

"I/Web Console: Received Event: deviceready at file:///android_asset/www/js/index.js:53"

Then it occurred to me, all they were looking for was “file:///” and after saving those changes in LinkedIn’s Developer site, I was up and running.

LinkedIn API Domain Key

2 thoughts on “LinkedIn Developer API Javascript Domains for Cordova Mobile App

  1. Lohith

    Hey Ben, I am writing to you to find out whether you have got this working for your cordova app. Please reply and share a documentation if you have any for this.

    I added “file:///” and “file:///android_asset/www/index.html” but there is no use. I still get the error “UNcaught Error: Javascript API domain is restricted to: 25”

  2. Carlo

    The current linkedIn Javascript Settings form doesn’t allow file:///

    You have to enter http:// or https://

    Any news or solutions?

Leave a Reply

Your email address will not be published. Required fields are marked *