I am using AngularJS 1.5.8 and trying to implement Linkedin API.

Linkedin authorization has two steps:

*1. Request an Authorization Code*

GET https://www.linkedin.com/oauth/v2/authorization

I successfully passed this step and received authorization code

*2. Exchange Authorization Code for an Access Token*

POST https://www.linkedin.com/oauth/v2/accessToken

I am trying to send POST request and it fails. Not sure what I am doing 
wrong. The code looks like this:

var url = 'https://www.linkedin.com/oauth/v2/accessToken';var params = 
    {
       'grant_type':'authorization_code',
       'code': CODE,
       'redirect_uri': REDIRECT_URL,
       'client_id': CLIENT_ID,
       'client_secret': CLIENT_SECRET
    };

$http({
 method: 'POST',
 headers: {
        'Content-Type': 'application/x-www-form-urlencoded' 
 },
 url: url,
 data: params}).success(function (result) {
     console.log(result);}).error(function (data, status, header, config) {
     console.log(data, status, header, config);});


Every time I've got next error:

 XMLHttpRequest cannot load https://www.linkedin.com/oauth/v2/accessToken. No 
'Access-Control-Allow-Origin' header is present on the requested resource.
 Origin 'http://localhost:8080' is therefore not allowed access. The response 
had HTTP status code 400.


Please, help to fix this. 
Many thanks

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to