400 error when submitting API refresh token request
I'm trying to set up the OAuth and generate the refresh token, but every time I send in the post request I get a 400 error and the message " An error occurred while processing your request.Please try again later."
I'm certain that all of the access information is correct so I don't know why I'm getting this error. I'm using axios to send the request and my code is
- const axios = require('axios').default;
- var FormData= require('form-data');
- var fd= new FormData;
- fd.append('grant_type', 'authorization_code');
- fd.append('client_id', '1000.xxxxxxxxxxxxxx');
- fd.append('client_secret', 'xxxxxxxxxxxxxxxxx');
- fd.append('redirect_uri', 'https://api-console.zoho.com/client/xxxxxxxxxxxx');
- fd.append('code','1000.xxxxxxxxxxxxx');
- axios({
- method:'post',
- url:'https://accounts.zoho.com/oauth/v2/token',
- data: fd
- })
- .then(response =>{
- console.log(response)})
- .catch(error => {console.log(error.response)
- });