title: How to get user profile data after getting access token from LinkedIn via Oath2
body: <p>I have a small node application that is retrieving an access token from LinkedIn after authenticating (authorizing) with Oath2.</p>
  
  <p>Now that I have the token I want to make a subsequent request to get a users profile data. The problem is that when I make the request the error says the following:</p>
  
  <pre><code>{"success":false,"msg":"403 - {\"serviceErrorCode\":100,\"message\":\"Not enough permissions to access: GET /me\",\"status\":403}"}
  </code></pre>
  
  <p>I've checked off all the "state" options in the LinkedIn app.</p>
  
  <p><a href="https://i.stack.imgur.com/ECqjf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ECqjf.png" alt="enter image description here"></a></p>
  
  <p>According to the LinkedIn API docs the token needs to be sent in a header. Like this:</p>
  
  <p><a href="https://i.stack.imgur.com/OLdIi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OLdIi.png" alt="enter image description here"></a></p>
  
  <p>( reference:  <a href="https://developer.linkedin.com/docs/oauth2#requests" rel="nofollow noreferrer">https://developer.linkedin.com/docs/oauth2#requests</a> )</p>
  
  <p>The route to get profile data is listed as:
  <a href="https://api.linkedin.com/v2/me" rel="nofollow noreferrer">https://api.linkedin.com/v2/me</a></p>
  
  <p><a href="https://i.stack.imgur.com/nDYzZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nDYzZ.png" alt="enter image description here"></a></p>
  
  <p>Here is the route that I want users to hit to get their profile data:</p>
  
  <pre><code>app.get("/user",async (req,res)=&gt;{
  
      console.log(token); /* token object is available in higher scope from previous request */
  
       var options = {
  
          url: "https://api.linkedin.com/v2/me",
          method: 'GET',
          headers: {
            'Host': "api.linkedin.com",
            'Connection': "Keep-Alive",
            'Authorization': 'Bearer ' + token.access_token
          },
  
          json: true // Automatically stringifies the body to JSON
      };
  
  
  
  
      try {
          var response = await makeRequest(options);
          return res.json({success:true})
  
          } catch (err) {
  
          return res.json({ success: false, msg: err.message});; // TypeError: failed to fetch
      }
  
  
  
  });
  </code></pre>