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.
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) => console.log(res.json()))
            .catch((err) => {
                console.log(err);
            });
        }