StullerDesign
StullerDesign

Reputation: 11

How to write a Adobe Sign OAuth in Deluge

I'm still learning Deluge, and I'm currently testing an integration with Adobe Sign. This code is written inside of Zoho Flow.

Here's the authorization request url in Adobe's documentation:

https://secure.na4.adobesign.com/public/oauth/v2?redirect_uri=https://example.com/oauthDemo& response_type=code&client_id=d4HQNPFIXFD255H&scope=user_login:self+agreement_write:account& state=S6YQD7KDA556DIV6NAU4ELTGSIV26ZNMXDSF7WIEEP0ZLQCLDQ89OYG78C3K9SROC8DXCGRVSGKU1IT1

Here's the code that I've written in Deluge on Zoho Flow:

void _CreateAdobeDocument()
{
// Part 1 : Authenticate Adobe and Create Document
//// OAuth Token Exchange
authCodeParams = Map();
authCodeParams.put("response_type","code");
authCodeParams.put("client_id",{"My-client-id"});
authCodeParams.put("redirect_uri","https://www.bigin.zoho.com");
authCodeParams.put("scope","agreement_read:account+agreement_write:account+agreement_send:account");
authCodeResponse = invokeurl
[
    url :"https://secure.na4.adobesign.com/public/oauth/v2?redirect_uri=https://www.bigin.zoho.com&response_type=code&client_id={My-client-ID}&scope=agreement_read:account+agreement_write:account+agreement_send:account"
    type :GET
    detailed:TRUE
];
info authCodeResponse;

The function executes successfully, and the info I get back (most of it), looks like this (sorry for the formatting):

    date : "Wed, 03 Apr 2024 21:33:43 GMT",
    server : "Apache",
    vary : "Accept-Encoding",
    3p : "CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"",
    pragma : "no-cache",
    strict-transport-security : "max-age=31536000; includeSubDomains;",
    set-cookie : "JSESSIONID=D98A6A8A9B0B26C9F95C9D6E06A6F174.app-b18; Path=/;  Domain=.na4.adobesign.com; HttpOnly; SameSite=None; Secure",
keep-alive : "timeout=15, max=200",
      x-xss-protection : "1; mode=block",
      x-content-type-options : "nosniff",
      x-robots-tag : "none",
      content-security-policy-report-only : "frame-ancestors 'self' ;report-uri /api/gateway/loggingserver/csp?source=adobesignprod&requestId=240403143454274.803&sessionId=CBHCRABAAA7V4Hdx9XHaWrmpRzGQVG5X3Nv4-O4s1giS_D4LhX8FM.app-b23&loginAccount=&embeddingApp=;",
      connection : "Keep-Alive",
      content-type : "text/html;charset=UTF-8",
      cache-control : "no-cache, no-store, must-revalidate, max-age=0, private",
      content-language : "en-US"
   },
   responseCode : 200
}

When this executes, it's supposed to be taking me to the sign-in page for Adobe Sign.

Any help or advice would be much appreciated, I think that this is how you learn best, by trying, testing, and asking others more knowledgeable for help.

Thanks

Upvotes: 1

Views: 45

Answers (1)

kailasam ta
kailasam ta

Reputation: 11

You can streamline the OAuth token generation process by using Postman instead of coding it directly in Deluge. Once you have obtained the token, you can utilize it in your API calls and use cases. Additionally, you can incorporate the refresh token API within your custom function to automatically refresh the token if it expires.

To enhance security, you can store your credentials in a JSON file and upload it to Zoho WorkDrive. Then, whenever you need to make a request, download the file from WorkDrive and parse its content using Deluge map functions.

For more information on downloading files from Zoho WorkDrive, refer to the following documentation: Zoho WorkDrive API - Download Server File

Upvotes: 0

Related Questions