code-examples-csharp icon indicating copy to clipboard operation
code-examples-csharp copied to clipboard

Error while requesting server, received a non successful HTTP code 400 with response Body: '{"error":"consent_required"}' with docusign Navigator API

Open nnam-droid12 opened this issue 10 months ago • 8 comments

I am using the docusign navigator api for the docusign hackathon and i added the required scope adm_store_unified_repo_read and models_read but i keep getting Caused by: com.docusign.esign.client.ApiException: Error while requesting server, received a non successful HTTP code 400 with response Body: '{"error":"consent_required"}' and i just filled the request form for access to the navigator api beta but i don’t know how long it will take to getting approved considering timeframe, please i would appreciate your assistance

nnam-droid12 avatar Jan 24 '25 20:01 nnam-droid12

Are you using JWT? You will need to get consent by building a URL that goes to account-d.docusign.com with the IK and scopes. Did you do that part?

InbarGazit avatar Jan 25 '25 00:01 InbarGazit

https://developers.docusign.com/platform/auth/consent/obtaining-individual-consent/ should help you do this

InbarGazit avatar Jan 25 '25 00:01 InbarGazit

Also, if you're using JWT, you'll need the impersonation scope in addition to the adm_store_unified_repo_read

InbarGazit avatar Jan 25 '25 00:01 InbarGazit

Sorry, I just noticed that you also had the models_read scope. Not sure what you're trying to do, but that scopes is reserved for Docusign internal use, and is not part of the public API (at least not yet). So, that may have also been the reason you're getting this error.

InbarGazit avatar Jan 25 '25 00:01 InbarGazit

I'm using jwt authorizationa flow and it works for other docusign api i am using except for the navigator api. OH, thank you InbarGazit i really don't know that the models_read scope is a reserved scope, that might be causing my error, I will try it without using the models_read scope and update you. thank you for your time

nnam-droid12 avatar Jan 25 '25 11:01 nnam-droid12

@InbarGazit ERROR 1 --- [nio-5050-exec-3] c.c.d.h.N.service.NavigatorApiService : HTTP Error: 400 BAD_REQUEST - Response body: {"code":"BadRequest","message":"An unspecified error occurred."} I'm getting the above error after i follow the link to the docs you provided with every instruction on granting individual consent with jwt auth and then just adm_store_unified_repo_read scope my navigator service, is there something I'm not doing correctly

`public Agreement getAgreement(String agreementId) throws Exception { String accessToken = tokenService.getAccessToken(); String url = NAVIGATOR_BASE_URL + "/accounts/" + accountId + "/agreements/" + agreementId;

    HttpHeaders headers = new HttpHeaders();
    headers.setBearerAuth(accessToken);
    headers.setContentType(MediaType.APPLICATION_JSON);
    headers.add("Authorization-Version", "2.0");

    HttpEntity<String> entity = new HttpEntity<>(headers);

    try {
        log.debug("Request URL: {}", url);
        log.debug("Request headers: {}", headers);

        ResponseEntity<String> rawResponse = restTemplate.exchange(
                url,
                HttpMethod.GET,
                entity,
                String.class
        );

        log.debug("Raw response: {}", rawResponse.getBody());

        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(rawResponse.getBody(), Agreement.class);

    } catch (HttpClientErrorException e) {
        log.error("HTTP Error: {} - Response body: {}", e.getStatusCode(), e.getResponseBodyAsString());
        throw new RuntimeException("Navigator API error: " + e.getResponseBodyAsString(), e);
    } catch (Exception e) {
        log.error("Unexpected error", e);
        throw e;
    }
}

`

nnam-droid12 avatar Jan 27 '25 00:01 nnam-droid12

@InbarGazit I just got to know docusign navigator api is not available for developers it is only for paid IAM users I don't know any way i can use it in my project for the hackathon if you provide any help i will greatly appreciate that or i will have to purchase IAM application

nnam-droid12 avatar Jan 27 '25 03:01 nnam-droid12

@nnam-droid12 Navigator API is in closed beta and is not restricted to paid IAM users - it is open to all developers - the next batch of approvals for the beta will be made within the next week or so. Unfortunately, this will be after the hackathon submission deadline, but beta participants are still welcome to explore Navigator API's capabilities without cost during the beta period.

f5th-dimensional avatar Jan 31 '25 17:01 f5th-dimensional