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

baseUrl #95

Open
willbt opened this issue Feb 10, 2017 · 5 comments
Open

baseUrl #95

willbt opened this issue Feb 10, 2017 · 5 comments

Comments

@willbt
Copy link

willbt commented Feb 10, 2017

Great work on this wrapper.

When moving from the Demo environment to Production I ran into issues because the DocuSign Endpoint is issued in the baseUrl which is part of the response from the login.
However this wrapper doesn't use the baseUrl for all subsequent requests instead opting for the static configuration endpoint.

Below is what the DocuSign support team said.

"This is most likely an issue with your baseUrl. In the demo environment all account URLs start with demo.docusign.net, however in production there are multiple sub-domains like www, na2, eu, etc.

To resolve all you need to do is parse the baseUrl value that is returned from the login call (property will be called base_uri if you are using OAuth authentication) and use that for subsequent API requests."

"It’s possible an account’s data center (ie baseUrl) can change though it’s rare. In either case best practice here is to always parse the Login API response you receive and use the user’s baseUrl that is returned in there as that will always be accurate and up to date.
"

@tcopeland
Copy link
Collaborator

Whoa that's a good catch @willbt. Definitely something we should square away.

@tcopeland
Copy link
Collaborator

tcopeland commented Apr 29, 2017

I think #102 will sort this out.

@tcopeland
Copy link
Collaborator

tcopeland commented May 1, 2017

Actually, #102 as written won't fix this. The problem is that the usual docusign_rest client code is probably something like:

d = DocusignRest::Client.new
d.create_envelope_from_template(various_args)

That is, I suspect clients are fetching the account id via the rake task, explicitly setting the account_id in an initializer and then relying on that account id being used in all requests. So get_account_id is not being invoked in normal gem usage, and so modifying that function to memoize base_url will not result in future API calls using that URL.

So we need to change things so that this information is being fetched from docusign's API. Some approaches:

  • change the DocusignRest::Client constructor to invoke get_account_id and memoize the returned values. But that would result in an unnecessary call if the client is going to use oauth (speaking of which, we also need to record base_uri as returned from the oauth endpoint).
  • modify all public instance methods to invoke get_account_id if acct_id is nil.

@nmccrea
Copy link

nmccrea commented Aug 31, 2017

Hey folks. Thanks for all your great work. How would you recommend working around this issue for anyone who needs to go to Production today?

@tommotorefi
Copy link
Contributor

@nmccrea FWIW I've been running in production for a couple months and the subdomain for my account hasn't changed.

Maybe someone with more experience can weigh in with how often it does change...

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

4 participants