title: How to fetch user data from LINE api in JavaScript?
body: <p>I am new to APIs, so I don't exactly know how I can use fetch() to get access token and then get user profile.
  LINE API: [https://developers.line.biz/en/reference/social-api/#issue-access-token]
  This is all I could figure out, so far. I can get the access token through curl using git bash, but I have no clue on how to write a code in JS to get the json data.
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function generate(e){
           e.preventDefault();
            fetch(('https://cors-anywhere.herokuapp.com/'+'https://api.line.me/v2/oauth/accessToken'), {
                 method: 'POST',
                  headers: {
                      'Content-Type': 'application/x-www-form-urlencoded'
                      },
                  body: JSON.stringify({
                      grant_type: 'authorization_code',
                      client_id: 'my_id',
                      client_secret: 'my_client_secret',
                      code: 'code',
                      redirect_uri: 'the link direct to'
                  })
              })
              .then((res) =&gt; console.log(res.json()))
              .catch((err) =&gt; {
                  console.log(err);
              });
          }</code></pre>
  </div>
  </div>
  </p>