Accesing zoho crm through axios client node.js

Accesing zoho crm through axios client node.js

I am trying to access ZOHO CRM by registering my AXIOS node js client. But I am getting 2 different types of error
1. ERROR: invalid_client
2. ERROR: Request failed with status code 400.

However when I do same thing with POSTMAN client it successfully creates access tokens. But not in axios.
I also binded parameters in Form Data.

Below program for your reference:

onst headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}

const body = {
'code': '1000.6391352c83fd8e4fe0561b22d1591347.1f31d1a5432dd0c8b72a8cbd838b386b',
'client_id': '1000.743Z8NDRB7LNTVTKE2L9C196GTVUJR',
'client_secret': '15e4d9cd917f3fab2197720f962d04bdacc0358b62',
'grant_type': 'authorization_code',
'redirect_uri': 'www.example.com'
}

let bodyFormData = new FormData();

bodyFormData.append('code', '1000.2274a3be9db4074cc008ff34c222a5fb.06eb183aaeba0ffe9d8188ea9ee524ba');
bodyFormData.append('client_id', '1000.2WVATI2TW9YZNRGWNMN9YSS9CXZ4AJ');
bodyFormData.append('client_secret', '15e4d9cd917f3fab2197720f962d04bdacc0358b62');
bodyFormData.append('grant_type', 'authorization_code');
bodyFormData.append('redirect_uri', 'www.example.com');

const url = 'https://accounts.zoho.com/oauth/v2/token';

axios.request({
url: 'oauth/v2/token',
method: "post",
baseURL: "https://accounts.zoho.com/",
data: bodyFormData,
headers: headers,
}).then(function (res) {
console.log(res.data);
});

      • Sticky Posts

      • How to Add Users to your Organization in ZohoMail?

        A better clarity so you can create other users to start using Zoho Mail. You can directly Add Users from the Control Panel to your Organization. You can invite users with the existing email address. If the person (user) already uses ZohoCRM, then you can import users from Zoho CRM. You can also import them using a .csv file. (if you are planning to add them in Bulk)  In this topic, We will be discussing on how to Add and Invite users only.  The Import options are self explanatory. ____________________________________________________________________________________________________________