V
V
Vadim2018-03-17 15:31:27
JavaScript
Vadim, 2018-03-17 15:31:27

How to set up OAuth2 authorization from LinkedIn in Angular 5?

Good day, help me set up user authorization using LinkedIn. The essence of the problem: the user is on the main page, there is a button, the user clicks on it and the linkedin window opens for him with a request to accept the conditions and give access to his profile information and he is redirected to another page. Following the documentation with making a GET request

https://www.linkedin.com/oauth/v2/authorization?response_type=code
    &client_id=86yqrscskh1acr&redirect_uri=http://localhost:4200&state=DCEeFWf45A53sdfKef424&scope=r_basicprofile

and ran into problems. 1. The problem of cross-domain requests, as far as I understand, they are blocked by the browser, tell me how can I fix this? it seems like you need to specify some kind of headers.
2. The problem is the response from the server that comes to me if the request passed, I installed an extension for Chrome that allows cross-domain requests and I get this in response. And I can’t understand what to do, in theory a window should appear to allow access. Please explain what am I doing wrong?
LinkedIn app settings oauth , JavaScript
get request
$.ajax({
      type: 'GET',
      url: url,
      header: { 'Access-Control-Allow-Origin:': '*' },
      success: function (resp) {
        console.log('Data RESP: ', resp);


      },
      error: function (error) {
        console.log('ERROR RESP: ', error);
      }
    });

I am writing an application in Angular 5, but I use jQuery for sending, just for an example.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question