Search code examples
c#asp.net-web-apiadobeechosign

Adobe Sign In API (echo sign) fetch library documents


I have started working with Adobe Sign In APIs. I have tested the available method here https://secure.na1.echosign.com/public/docs/restapi/v6;jsessionid=6B036BE57F4653E3FE5E5A4DE95172E9.app-a6#!/libraryDocuments/getLibraryDocuments and was able to fetch all library documents

In the above test page, first it requires OAuth Access Token , which can be retried with help from below url https://secure.na1.echosign.com/public/static/oauthDoc.jsp

I have tried the method which is mentioned in "Authorization Request" section from above link, but didn't succeeded.

Below is the code which I have used in my application

private static string CLIENTID = "Client_ID";
    private static string SCOPE = "library_read:self";
    public static String OAUTH_BASE_URL = "https://secure.na1.echosign.com/public/oauth?redirect_uri={0}&response_type=code&client_id={1}&scope={2}";

    public static async Task<HttpResponseMessage> MakeAPICallAsync()
    {
        HttpResponseMessage httpResponseMessage;
        using (var client = new HttpClient())
        {
            client.BaseAddress = new Uri(string.Format(OAUTH_BASE_URL, "http://localhost:63274/Home/Validate", CLIENTID, SCOPE));
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            //GET Method  
            httpResponseMessage = await client.GetAsync("/");
            if (httpResponseMessage.IsSuccessStatusCode)
            {

            }
            else
            {
                Console.WriteLine("Internal server Error");
            }
        }

        return httpResponseMessage;
    }

The Problem is, it does nothing when I run the application, nor it redirects to the url provided in "redirect_uri" parameter.

Can anyone help me on this?


Solution

  • Finally after doing lot of research I was able to get this working taking help from link

    There were actually 2 different problems in the URL

    1. The region for the "secure" part of URL

      https://secure.in1.echosign.com/public/oauth

      I am in India so it was in1 for me. This is not written in the documentation.

    2. The scopes!

      As couple of people nicely said it, both your request string AND your application checked scopes MUST match.

      So, for example here was my test application scopes Only user_login:self is checked

    enter image description here

    So your request MUST be: scope=user_login:self

    None of the above 2 things are mentioned in Adobe API documentation.

    After applying above 2 changes, I was able to get the access token in my application.