Monthly Archives: June 2013

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