2 Step Authentication Delivery

Follow

This article goes into detail for how you can set up a 2 Step Authentication Delivery. If your clients remote system needs you to make an authentication call to gather a token before submitting the lead data, then this article should help you!


Before you start make sure you have guidance which details both requests (the authentication AND the lead Delivery request).

 

Step 1

Lets start by creating a new Delivery with the Method as 2 Step Delivery:

 

Step 2

Time to populate the 1st request with your authentication call details.

Add your authentication endpoint to the URL, select the correct method and fill out the payload as appropriate. You can add tags here through the "show tag help" button as you normally would.

 

Step 3

The final step of formatting the 1st request is to tell LeadByte how to capture the token being returned for use in the 2nd call.

This is done by selecting the "Response type" found under the payload builder.

 

Text will simply capture the entire string returned

EG text response - ABC123

 

JSON and XML allows you to choose a specific field name which will contain the Auth token

EG JSON response - 

{
"status": "Success",
"token": "ABC123",
"expires": "Never"
}

 

EG XML response - 

<response>
<status>Success</status>
<token>ABC123</token>
<expires>Never</expires>
</response>

 

Both of these tokens would be captured by populating the Auth token field with token - 

Image 2023-01-03 at 11.19.37 AM

CUSTOM provides you with options to fine tune exactly where you'd like LeadByte to capture the token from either using a "split by" function or looking for a keyword in your response. The (i) tooltips shown on the delivery screen provide all the information you might need here.

 

Step 5

Time to populate the 2nd request with your lead delivery details.

Add your lead submission endpoint to the URL, select the correct method and fill out the payload as appropriate. You can add tags here through the "show tag help" button as you normally would.

 

You can tell LeadByte to populate the token you stored from the 1st request by using the [AUTHTOKEN] tag.

EG request body using tag

Capture.PNG

 

 

EG custom headers using tag:

Capture.PNG

 

Step 6

Set your remote system response for the 2nd request as you normally would and test!

 

As always, please raise a support ticket if you have any issues. Make sure you save your Delivery and include the LeadByte URL in your ticket details.

 

Token Caching

Our 2 Step delivery method offers functionality to cache the auth token to bypass the need to generate a fresh token via the first request, until the token expiry time received from the initial first request has expired.

The "Token expiry" value will need to match the key label relating to the expiry time that the receiving system returns in the first request.

If we take this example auth token response:

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "def50200b6f2d7f5f6d2...",
  "scope": "read write"
}

You would configure your delivery like this to cache the token:

The expiry time must come back in the API response with a standard expiry time in seconds and the key can be mapped into the "Token expiry" box.

 

If you needed to capture the [AUTHTOKEN] into a custom data field for whatever reason, you can map [AUTHTOKEN] to a field using the "Assign response portion to lead" functionality. More information on this can be found here - Assign delivery response to a lead field
 


 

 

Was this article helpful?
0 out of 0 found this helpful

Comments