Hi Polokh Andrey,
Hope you solved the issue.

Currently I am also working on  implementation of OAUTH in my AngularJS 
application.

When the request for the authorization code raises , it will ask for 
credentials,
* so, in my case the credentials page should be open in new pop up window. *
*After entering the credentials, the authorization code should be passed to 
the child page.*

So, can you give me some inputs how to handle this????

Thanks in Advance.
Surendra M.


On Wednesday, August 3, 2016 at 6:20:30 PM UTC+5:30, Polokh Andrey wrote:
>
>
> 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 
"Angular and AngularJS discussion" 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