docusign-esign-java-client icon indicating copy to clipboard operation
docusign-esign-java-client copied to clipboard

getAuthorizationURL return a malformed URI

Open ta7tou7 opened this issue 4 years ago • 7 comments

We have upgraded recently our version from 3.6 to 3.8 and we have noticed a regression regarding the built URI.

our current code to build the uri is:

ApiClient client = new ApiClient();
client.setOAuthBasePath(authServerUrl);
URI uri = getAuthorizationUri(clientId, scopes, redirectUri, "code", state);

with an authServerUrl = 'account.docusign.com'

What we got in the output is: 'https:/account.docusign.com' instead of `https://account.docusign.com' (one missing slash after https)

ta7tou7 avatar Oct 06 '20 10:10 ta7tou7

@ta7tou7 apologies for not reaching out earlier. If this is still an issue, in order for us to reproduce the scenario, we need to know how to get to this malformed URI? Are you using System.out.println, using an IDE debugger or enabling verbose logs? Please share more details if possible.

mmallis87 avatar Oct 14 '20 22:10 mmallis87

@mmallis87

ApiClient client = new ApiClient();
client.setOAuthBasePath(authServerUrl);
URI authUri = client.getAuthorizationUri(clientId, scopes,redirectUri, "code", state);
return authUri.toString();

When using account.docusign.com as "authServerUrl" what we got with the method above is => https:account.docusign.com/...' while we need an url with like this one https://account.docusign.com/...`

ta7tou7 avatar Oct 15 '20 09:10 ta7tou7

I have tried also to add the scheme the the authServerUrl => https://account.docusign.com instead of account.docusign.com but while I get the right url with the method above, I wouldn't be able to generate the access token (duplicated https => see method ApiClient.#generateAccessToken line 614)

ta7tou7 avatar Oct 15 '20 09:10 ta7tou7

@ta7tou7 I still don't know where do you see the generated URL. Do you log the value to the console, do you open it in a browser window or do you inspect it via an IDE. Please tell us which one of these methods do you use and if you can share a screenshot that will be great!

mmallis87 avatar Oct 15 '20 18:10 mmallis87

closing due to lack of activity. Please re-open of this is still an issue. Thank you

LarryKlugerDS avatar Nov 01 '20 09:11 LarryKlugerDS

FYI:

This is still an issue with version 3.18. To reproduce:

ApiClient apiClient = new ApiClient();
apiClient.setOAuthBasePath("account-d.docusign.com");
URI uri = apiClient.getAuthorizationUri(clientId, List.of("signature"), "http://localhost/", "code");
System.out.println(uri);

This results in a uri starting with: https:account-d.docusign.com/oauth/auth?response_type=code...

Explicitly adding "https://" to the beginning of the OAuth base path works.

avromf avatar May 17 '22 14:05 avromf

Thank you all for sharing these code snippets. I create an internal ticket for me and the team to investigate further.

mmallis87 avatar May 17 '22 18:05 mmallis87