launcher-csharp 演示中的 JWT 流程

JWT flow in launcher-csharp demo

我正在玩来自 DocuSign GitHub 的 launcher-csharp 演示。它适用于授权代码授予流程。但是当我尝试 运行 JWT 流时,在这个调用中抛出异常:

        public void UpdateUserFromJWT()
        {
            this._authToken = _apiClient.RequestJWTUserToken(
                this._configuration["DocuSignJWT:ClientId"],
                this._configuration["DocuSignJWT:ImpersonatedUserId"],
                this._configuration["DocuSignJWT:AuthServer"],
                DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(this._configuration["DocuSignJWT:PrivateKeyFile"])),
                1);

异常表示服务器返回了 "consent_required" 错误。 “How to get an access token with JWT Grant”文档部分中的错误描述说,这意味着用户没有同意,这不是我的情况,或者 URI 配置有问题。我仔细检查了 appsettings.Development.json.

中的 DocuSignJWT 部分

显然我做错了什么,但是什么?

您必须先同意 JWT。

https://account-d.docusign.com/oauth/auth?
response_type=code
&scope=signature%20impersonation
&client_id=your integration key
&redirect_uri=your **encoded** callback url from the ikey settings 

例如“https%3A%2F%2Flocalhost%3A9090%2Fds%2Fcallback”。