Support for Signed JWSs are not supported error while validating Freshchat Retrieve account information API

  1. I’m facing error while validation of Freshchat domain for a verify button in my installation page, I attached the screenshot of error in console page, network logs for referances
function verify() {
 
  try {
    var response = client.request.invokeTemplate('verify', {
      context: {
        freshChatUrl: freshchat_domain.value,
        freshChatKey: freshChat_key.value,
      },
    })

    console.log('response', response)

    if (response.status == 200) {
      alert('Verified Successfully')
      verified = true
    } else if (response.status == 401) {
      console.error('Error: Domain or API key is invalid')
      verified = false
    }
  } catch (error) {
    console.error('Error while verify', error)
    verified = false
  }
}

// Call verify function when needed

function validate() {
  return verified
}


localhost.har (6.9 MB)

requests.json ===>

    "schema": {
      "protocol": "https",
      "method": "GET",
      "host": "<%= context.freshChatUrl %>",
      "path": "/v2/accounts/configuration",
      "headers": {
        "Authorization": "<%= (context.freshChatKey) %>",
        "Content-Type": "application/json"
      }
    }
  }

Hey @Abdul_Ghani,
To help you with this query, I’ve shared this concern with the required teams.

Hey @Abdul_Ghani,

Can you share the CURL command used in Postman and the latest requests.json (if any schema changes)?

Hi Jones,

we don’t have any changes so far

Please find the CURL copied from postman

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://swethaganesh-614364492894024874-886a94070284f1316927872.freshchat.com/v2/accounts/configuration',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer eyJra````````````````````````````````````````````YytPg'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Also, Rquestes.JSON for your reference

  "verify": {
    "schema": {
      "protocol": "https",
      "method": "GET",
      "host": "<%= context.freshChatUrl %>",
      "path": "/v2/accounts/configuration",
      "headers": {
        "Authorization": "Bearer <%= encode(iparam.freshChat_key) %>",
        "Content-Type": "application/json"
      }
    }
  }

Hey @Abdul_Ghani,
I see that the request template uses bothiparam and context.

If I understand correctly, this request is being made from custom iparams page, so both domain and api key would have to be passed via context.

This requests.json that was previously shared is correct where both freshChatUrl and freshChatKey are passed via context but the change needed is

"Authorization": "Bearer <%= encode(context. freshChatKey) %>"

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.