ishant.kesar

Unable to Invoke Callback Service

0 votes

I was trying to implement Call back service in Salesforce from One Span. I have implemented all the steps in Salesforce mentioned in Part 1, Part 2 and Part 3. But however when a transaction is completed in One Span my apex method is not being called. No logs as well. What is the best way to debug this. Please guide


Approved Answer

Reply to: Unable to Invoke Callback Service

0 votes

Thanks for the confirmation! I can confirm that the client id, refresh token and the SFDC host are correct in your account settings. 

While for the domain URL, not sure it's correct or not - is your domain https://xx--xx.my.salesforce.com/ (there's a second level domain my)? It seems you didn't add the second level domain for your callback endpoint:

https://xxx--xx.salesforce.com/services/apexrest/oss/callback

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Unable to Invoke Callback Service

0 votes

HttpResponseException: status code: 503, reason phrase: 503: IOException: Unexpected response code for CONNECT: 503

I got below response in the email. Please suggest


Reply to: Unable to Invoke Callback Service

0 votes

Hi ishant.kesar,

 

I think you can troubleshoot from below aspects:
(1)Manually send a callback:

-Get an access token via below link:
https://login.salesforce.com/services/oauth2/token?client_id={your_client_id}&grant_type=refresh_token&refresh_token={the_refresh_token}

-Make below POST call from any HTTP client (e.g. Postman):

POST https://yourdomain.salesforce.com/services/apexrest/oss/callback

Authorization: Bearer {access_token}

Example Payload: {"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_COMPLETE","sessionUser":"0787be84-f095-44c7-ba00-787093df86fc","packageId":"KHiRfOXgKK0gpVWwwpFOSNy6o34=","message":null,"documentId":null}

-Check in Developer Console if there's an inbound call hitting your exposed REST API

(2)Double check your OAuth Registry at OneSpan Sign Callback Service

-Retrieve the OSS OAuth callback information via below API

GET /api/callback/connectors/salesforceOauth2

-Check if the callback endpoint is correct (e.g. https://yourdomain.salesforce.com/services/apexrest/oss/callback)

-Base64 decode the "key" and check if you have provided the correct host, client id and refresh token

Note: The “host” refers to either “test.salesforce.com” (SFDC sandbox) or “login.salesforce.com” (SFDC production/developer). It’s not a full URL (without “https://”) and doesn’t refer to your own domain.

(3)If these can't help you pinpoint the cause of issue, could you send a screenshot of the failure email as well as your account email to [email protected] so that I can take a closer look at the issue?

 

Duo

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Unable to Invoke Callback Service

0 votes

I have tried both the option but didn't worked out. Can you please look. I have sent an email to community 

 

Error: tunneling socket could not be established, statusCode=503

POST MAN Error

 


Reply to: Unable to Invoke Callback Service

0 votes

Hi ishant.kesar,

 

Thanks for the information, few things I noticed from your setup:
#1. Seems the refresh token has been expired or incorrect. When I use your setup to build below link (it'll return an access token with refresh token flow):

https://login.salesforce.com/services/oauth2/token?client_id={your_client_id}&grant_type=refresh_token&refresh_token={the_refresh_token}

It returned an invalid_request error which typically is caused due to wrong or expired client ID or refresh token.

<OAuth>

<error>invalid_request</error>

<error_description>must use HTTP POST</error_description>

</OAuth>

 

#2. You OAuth Registry at OneSpan Sign Callback Service looks like this:
 

{
  "url": "https://xxx.salesforce.com/services/apexrest/oss/callback",
  "events": [
    "DOCUMENT_SIGNED",
    "EMAIL_BOUNCE",
    "KBA_FAILURE",
    "PACKAGE_ACTIVATE",
    "PACKAGE_ARCHIVE",
    "PACKAGE_ATTACHMENT",
    "PACKAGE_COMPLETE",
    "PACKAGE_CREATE",
    "PACKAGE_DEACTIVATE",
    "PACKAGE_DECLINE",
    "PACKAGE_DELETE",
    "PACKAGE_EXPIRE",
    "PACKAGE_OPT_OUT",
    "PACKAGE_READY_FOR_COMPLETE",
    "PACKAGE_RESTORE",
    "PACKAGE_TRASH",
    "ROLE_REASSIGN",
    "SIGNER_COMPLETE",
    "SIGNER_LOCKED",
    "TEMPLATE_CREATE"
  ],
  "key" (decoded): {
  "host": "https://xxx.lightning.force.com/",
  "client_id": "3MVG9EMJF5MdlzxxxbF8oHNnFbea",
  "refresh_token": "5Aep8611pOExxxdwGpI0OCR"
}
}

Note the "key" > "host" attribute, it should be either “test.salesforce.com” (SFDC sandbox) or “login.salesforce.com” (SFDC production/developer). It’s not a full URL (without “https://”) and doesn’t refer to your own domain.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Unable to Invoke Callback Service

0 votes

Hi Duo,

 

The first point - It’s a sandbox so you need to run the test.salesforce.com

 

for the second- I follow the exact same steps. i used the test.salesforce.com


Reply to: Unable to Invoke Callback Service

0 votes

You're pretty AWESOME. Thank you so much for helping me here!

After adding https://xx--xx.my.salesforce.com/ in the domain URL, it was working FINE


Reply to: Unable to Invoke Callback Service

0 votes

Great to hear that! And thanks for the appreciation!

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off