ngCordova oauth Example with Linkedin

By: Ryan Wong at

I find most examples on the web are very barebone and nothing on linkedin Oauth. So heres an example with linkedin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function Ctrl(scope, $cordovaOauth, oauthService){
$cordovaOauth.linkedin("clientKey", "clientSecret", [
"r_basicprofile",
"r_fullprofile",
"r_contactinfo",
"r_network",
"r_emailaddress"],
"csrf token you make").then(function(result) {
var access_token = result.access_token;
var expire_date = result.expires_in;
oauthService.getLinkedinProfile(access_token).then(function(result){
//do what you want
}, function(err){
//handle error
});
});
}

The oauthService is calling this url
https://api.linkedin.com/v1/people/~:(email-address,first-name,last-name)?format=json&oauth2_access_token=“ + access_token;

Hope this saves you time.