# \[OAuth\] Request access token error!

**URL:** <https://devforum.zoom.us/t/oauth-request-access-token-error/76153>\
**Category:** Authentication\
**Created:** [September 19, 2022, 3:05am UTC](https://devforum.zoom.us/t/oauth-request-access-token-error/76153 "2022-09-19T03:05:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kerriganhjh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kerriganhjh/32/41460_2.png) [@kerriganhjh](https://devforum.zoom.us/u/kerriganhjh)\
**Post date:** [September 19, 2022, 3:05am UTC](https://devforum.zoom.us/t/oauth-request-access-token-error/76153/1 "2022-09-19T03:05:18Z")

</div>

**Description**

I test OAuth features and there are some problems  
In my test env is local

I tried blow steps  
1.Request user authorization on my frontend web(local test 127.0.0.1) and work well and redirected to URL that is on [Redirect URL for OAuth] of App credentials.  
2.get a CODE from redirected querystring  
3.call backend server(local test nodejs) with Returned CODE from step2  
blow is my code

```auto
 app.get('/z1/:code', (req, res) => {

  var rcode = req.params.code;

  fetch("https://zoom.us/oauth/token", {
    method: "POST",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
      "Authorization":"Basic ZjhmSklINXNUNHVrSVQyc2I4Wk1OZzo5ODV1U3dSNkpkclJWcW1wWGljTkVzSkw0QThqMXZCMg=="
    },
    body: JSON.stringify({
      code:rcode,
      grant_type:'authorization_code',
      redirect_uri:'http://127.0.0.1:8080/eden/zoomredirect'
    }),
  }).then((response) => console.log(response));
      
  
});

```

**but error is returned**

```auto
Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://zoom.us/oauth/token',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}

```

---

<div class="post-metadata">

**Author:** ![kerriganhjh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kerriganhjh/32/41460_2.png) [@kerriganhjh](https://devforum.zoom.us/u/kerriganhjh)\
**Post date:** [September 19, 2022, 5:15am UTC](https://devforum.zoom.us/t/oauth-request-access-token-error/76153/2 "2022-09-19T05:15:51Z")

</div>

I tested on Postman . but postman works well…  
What was I wrong…

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [September 19, 2022, 8:57pm UTC](https://devforum.zoom.us/t/oauth-request-access-token-error/76153/3 "2022-09-19T20:57:51Z")

</div>

Hi @kerriganhjh  
Thanks for reaching out to the Zoom Developer Forum, I am happy to help here!  
It looks like you are passing the grant\_type, the code and the redirect uri as a part of a body, when this should be included in your request url as query params, it should look something like this:

```auto
fetch("https://zoom.us/oauth/token?grant_type=authorization_code&code={yourCode} &redirect_uri={yourRedirectUri}/", requestOptions)

```

---

<div class="post-metadata">

**Author:** ![kerriganhjh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kerriganhjh/32/41460_2.png) [@kerriganhjh](https://devforum.zoom.us/u/kerriganhjh)\
**Post date:** [September 20, 2022, 1:42am UTC](https://devforum.zoom.us/t/oauth-request-access-token-error/76153/4 "2022-09-20T01:42:42Z")

</div>

thanks. cool It’s my faults

another questions

When Publish my Web, Is it possible to call zoom api (OAuth get Access token and etc) on frontend?  
Should I call Zoom API via my backend server?

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [September 20, 2022, 11:25am UTC](https://devforum.zoom.us/t/oauth-request-access-token-error/76153/5 "2022-09-20T11:25:50Z")

</div>

@kerriganhjh  
No worries! Happy that helped.  
You should be getting Access token and calling API via backend 🙂
