Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nnam-droid12 opened this issue Jan 24, 2025 · 8 comments

Comments

@nnam-droid12
Copy link

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

@InbarGazit
Copy link
Member

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
Copy link
Member

@InbarGazit
Copy link
Member

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

@InbarGazit
Copy link
Member

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.

@nnam-droid12
Copy link
Author

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
Copy link
Author

@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
Copy link
Author

nnam-droid12 commented Jan 27, 2025

@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

@f5th-dimensional
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants