Fedex Access token-SCA

Below function can be used for generating the FedEx access token using an extension

      tokenGeneration: function () {

        try {

          var clientId = Configuration.get(‘FedEx.ClientId’);

          var clientSecret = Configuration.get(‘FedEx.ClientSecret’);

          var url = Configuration.get(‘FedEx.AuthorizationURL’);

          var bodyObj = {

            “grant_type”: “client_credentials”,

            “client_id”: clientId,

            “client_secret”: clientSecret,

          }

          var headers = {

            ‘Content-Type’: ‘application/x-www-form-urlencoded’,

            ‘Accept’: ‘*/*’,

            ‘Accept-Encoding’: ‘gzip, deflate, br’,

            ‘Connection’: ‘keep-alive’

          }

          var apiResponse = nlapiRequestURL(url, bodyObj, headers, null, “POST”);

          return apiResponse

        } catch (err) {

          console.error(“error in Fedex tokenGeneration suitescript”, err);

        }

      }

Leave a comment

Your email address will not be published. Required fields are marked *