Error on live server when requesting Docusign JWT user token for remote signing

49 views Asked by At

I integrated docusign remote signing in my laravel project. It was working fine but unfortunately from previous two days , same code throws error on live server when I tried to request JWT user token.

The error is..

API call to https://account.docusign.com/oauth/token failed, but for an unknown reason. This could happen if you are disconnected from the network.

This is the code from where error arises..

private function getToken(ApiClient $apiClient): string
    {
        try {
            $privateKey = \File::get(storage_path(env('DS_KEY_PATH')));
            $response = $apiClient->requestJWTUserToken(
                $ikey = env('DS_CLIENT_ID'),
                $userId = env('DS_IMPERSONATED_USER_ID'),
                $key = $privateKey,
                $scope = env('DS_JWT_SCOPE')
            );
            $token = $response[0];
            $accessToken = $token->getAccessToken();
        } catch (\Throwable $th) {
            dd($th->getMessage());
            throw $th;
        }
        return $accessToken;
    }

The main point from where error arises is this piece of code..

$response = $apiClient->requestJWTUserToken(
                $ikey = env('DS_CLIENT_ID'),
                $userId = env('DS_IMPERSONATED_USER_ID'),
                $key = $privateKey,
                $scope = env('DS_JWT_SCOPE')
            );
1

There are 1 answers

0
Larry K On

Check that you're using the production OAuth service provider, https://account.docusign.com

Best is to record a log of your app's network events and check the log.

See this SO question