ETIMEDOUT in node.js when make a POST

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

  1. const FormData = require('form-data');
  2. const axios = require('axios')
  3. var data = new FormData();
  4. data.append('refresh_token', '1000.token');
  5. data.append('client_id', '1000.id');
  6. data.append('client_secret', 'secret');
  7. data.append('scope', 'Desk.tickets.CREATE');
  8. data.append('redirect_uri', 'https://www.zylker.com/oauthgrant');
  9. data.append('grant_type', 'refresh_token');

  10. var config = {
  11.       method: 'post',
  12.       url: 'https://accounts.zoho.com/oauth/v2/token'
  13.       data: data
  14. };
  15. 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
                });
            






                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        Manage your brands on social media



                                                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 WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now