Nebster
Nebster

Reputation: 914

Going live with PHP SDK: Error 401 Unauthorized

After all the neccesary steps in Sandbox/Demo account my Integrator key was marked Live and I attached it to live account.

I am using DocuSign PHP SDK so I changed API username, API password, API account ID and Host to Live account credentials according to this guide - Post Go Live steps.

DocuSign API settings

Anyway I am getting error 401 Unauthorized when attempting to create Envelope (or anything else).

Upvotes: 0

Views: 118

Answers (1)

Nebster
Nebster

Reputation: 914

Solution:

When going live while using DocuSign PHP SDK, set Host parameter to https://eu.docusign.net/restapi or any other subdomain provided by DocuSign that suits you best (eu, na1 ,na2, etc...).

Explaination:

When working with DocuSign PHP SDK, you don't need to do login request to retrieve baseUrl parameter for your actual request (ex: creating Envelope). Instead you set Host parameter right at the beginning of your code and don't care about baseUrl anymore.

And that is where the problem lies. WITHOUT SDK, you first do login request to https://www.docusign.net/restapi/v2/login_information to get back your baseUrl paramater (ex: https://eu.docusign.net/restapi/v2/account/1234/envelopes) and use that for actual request. So when working WITH SDK, set the subdomain of Host parameter to eu, na1, na2 or any other valid value provided by DocuSign right away.

I found the solution thanks to this answer: https://stackoverflow.com/a/44119359/3970975

Upvotes: 2

Related Questions