ETIMEDOUT in node.js when make a POST
Hello everyone!
I have a problem when i make a POST request to accounts.zoho.com/oauth/v2/token for refresh access token in Javascript whit the API. I'm trying whit axios and request but nothing works, only keeps loading and after a few seconds the response is a ETIMEDOUT error.
Also i'm trying to create a ticket whit the API but the problem it's the same.
When i make any GET or POST on Postman (whit the same data that i use on javascript) it works whitout problems, retrieves the new token and i can create tickets. Even i'm using the code generated by Postman but not works.
Anyone else have this problem? I don't known what i'm doing wrong on javascript but on postman it's fine.
CODE IN JAVASCRIP FOR REFRESH ACCESS TOKEN
- const FormData = require('form-data');
- const axios = require('axios')
- var data = new FormData();
- data.append('refresh_token', '1000.token');
- data.append('client_id', '1000.id');
- data.append('client_secret', 'secret');
- data.append('scope', 'Desk.tickets.CREATE');
- data.append('redirect_uri', 'https://www.zylker.com/oauthgrant');
- data.append('grant_type', 'refresh_token');
- var config = {
- method: 'post',
- url: 'https://accounts.zoho.com/oauth/v2/token'
- data: data
- };
- const data_response = await axios (config).then(function (response) {
console.log(JSON.stringify(response.data));
return JSON.stringify(response.data)
})
.catch(function (error) {
console.log(error);
return error
});
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.