docusign / docusign-esign-php-client

The Official Docusign PHP Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
https://www.docusign.com/devcenter
MIT License
197 stars 124 forks source link

QUESTION: Error on JWT Grant Authentication with SDK #187

Closed samuel-lujan closed 1 year ago

samuel-lujan commented 1 year ago

Error: invalid_grant error_description issuer_not_found

Hello, I'm trying to connect with Docusign API using de SDK, to create an envelope, but on executing the method "requestJWTUserToken" or "requestJWTApplicationToken" with my correct credentials, got this error.

image

image

Adrian-DS-Support commented 1 year ago

Hi Samuel,

The issuer is the integration key (DocuSign-ClientID). Please make sure the env('DOCUSIGN_CLIENT_ID') is providing the integration key you created in your DocuSign "Settings- Apps & Keys" page and that it's not missing any characters.

We hope this helps.

Adrian DocuSign Developer Support

bastien70 commented 1 year ago

Hello, I've exactly the same problem, and I think I put the good information.

        $integratorKey = '(this is the integrator key on my docusign app, see number 2 in the screenshots)';
        $userId = '(this is my user_id key on the developer dashboard, see number 1 in the screenshot)';
        $privateKey = file_get_contents(__DIR__ . '/private_key'); // This is the privateKey generated in the app (Check number 3 i n screenshot, I've a keypair. I'm not using the keypair, but the long privateKey so it's okay)
        $scope = ApiClient::$SCOPE_SIGNATURE;
        $config = new Configuration();
        $config->setHost('https://demo.docusign.net/restapi');
        $apiClient = new ApiClient($config);

//        $apiClient->getOAuth()->setOAuthBasePath()

        try {
            $userToken = $apiClient->requestJWTUserToken($integratorKey, $userId, $privateKey, $scope);
            dd($userToken);
        } catch (\Throwable $th)
        {
            dd($th->getMessage(), $th->getTrace());
        }

And I've exactly the same error message that @samuel-lujan

image

This is my app details : image

bastien70 commented 1 year ago

Wait, I've the problem too xDD have you got a discord or other ? I would like some help to login myself with the SDK, I had the same problem, but I can't fix it, I don't understand why

bastien70 commented 1 year ago

Yeaah, you are the best :P I added you :)

samuel-lujan commented 1 year ago

We did some call and solve the error! The error is caused because your application is not allowed to use your integration key on docusign. You first need to go into this link where you can create an URL to give permission to your application. After this you need to set in your ApiClient the oauthBaseUrl with this code: $this->docusignApiClient->getOAuth()->setOAuthBasePath("account-d.docusign.com"); and after this you done. you can go on and create the envelope @bastien70 did and call with me and can help me if did I forgot something