0

I am looking for Integration of DocuSignApi with Angular. I am following these steps. Angular Application Backend Server using .net core Web API to handle and DocuSign api using nuget.

Can I achieve this?

  • Option 1 - Angular application - will hit - login method of middleware api application - middleware will communicate - docusign - after successful it will share details of logged in users.

  • Option 2 - Angular application - directly hit to docusign methods for this When I am doing like this

      var url = "https://account-d.docusign.com/oauth/auth?response_type=token&scope=signature&client_id=XXXXXXXXXXXXXXX-01caXXXXXXXX&state=a39fh23hnf23&redirect_uri=http://localhost:81/";
    
      return this._dataService.getThirdParty1(url, header)
          .pipe(map((response: Response) => {
              return response;
          }));
    
    
    
    
    - public getThirdParty(url) {
    
         return this._httpClient.get(          url).pipe().pipe(map(this.handleResponse)).pipe(catchError(this.handleError.bind(this)));
    
     }
    

I am getting error

Access to XMLHttpRequest at 'https://account-d.docusign.com/oauth/auth?response_type=token&scope=signature&client_id=XXXXXXXXXXXXXXX-01ca8f1b220&state=a39fh23hnf23&redirect_uri=http://localhost:81/' from origin 'http://localhost:81' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. account-d.docusign.com/oauth/auth?response_type=token&scope=signature&client_id=XXXXXXXXXX-411a-9bb9-01ca8f1b220&state=a39fh23hnf23&redirect_uri=http://localhost:81/:1 Failed to load resource: net::ERR_FAILED

Please provide a way to check these options.

1 Answer 1

1

First, your issue is that you are making client-side calls to DocuSign from a different domain which validated CORS policy which is a security concern. (Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading of resources. CORS also relies on a mechanism by which browsers make a "preflight" request to the server hosting the cross-origin resource, in order to check that the server will permit the actual request. In that preflight, the browser sends headers that indicate the HTTP method and headers that will be used in the actual request.)

Larry wrote extensively on this topic and here are some of the resources that can help.

Here is a three part series on the topic - https://www.docusign.com/blog/dsdev-building-single-page-applications-with-docusign-and-cors-part-1

Here is his code in GitHub showing you how to create a CORS gateway - https://github.com/docusign/blog-create-a-CORS-gateway

One other useful resource - https://www.cdata.com/kb/tech/docusign-odata-angularjs.rst

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.