atlassian cloud oauth 2.0, Error 403 on POST request to get token

I am going to integrate my angular app with Jira cloud. To authenticate users, Atlassian uses OAuth 2.0 to let the external apps access product API on users' behalf. I followed the instruction from this page

  1. Direct the user to the authorization URL to get an authorization code
  2. Exchange the authorization code for an access token
  3. Authorize any calls to the product APIs using the access token
  4. Check site access for the app

I successfully pass the first step. But at the second step, my POST request to get the token gets failed. This is my request data

    {
    "grant_type":"authorization_code",
    "client_id":"xxx", 
    "client_secret":"xxx",
    "code":"xxx", // I receive this code from callback url from atlassian login page
    "redirect_uri":"http://localhost:4200/"}

This is the header:

{'Content-Type': 'application/json'}

And this is what I receive:

{"error":"invalid_grant","error_description":"Invalid authorization code"}

this is the request code written in Angular 10:

this.http
        .post(
          'https://auth.atlassian.com/oauth/token', {
            grant_type: 'authorization_code',
            client_id: environment.oauth.clientID,
            client_secret: environment.oauth.secret,
            code: codeStr,
            redirect_uri: environment.oauth.redirect_uri
          }, {
            headers: exchangeAuthCodeHeader,
            responseType: 'json'}
        ).subscribe((data) => console.log(data), (error) => console.log(error));

I have been stuck in this error for a couple of days :( Any idea would be a great help.