创建JWT令牌时出错 [英] Error when creating JWT Token

查看:102
本文介绍了创建JWT令牌时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正要从使用传统标头身份验证方法 JWT令牌方法,我使用了以下示例,此处

As I am on my way to switch from using the legacy header authentication method to the JWT Token method, I have used the following example found here.

但是,出现以下错误:

Error calling Login: {
  "errorCode": "PARTNER_AUTHENTICATION_FAILED",
  "message": "The specified Integrator Key was not found or is disabled. An Integrator key was not specified."
}

下面是我的C#代码。

Below is my C# code.

string oauthBasePath = "account-d.docusign.com";
string privateKeyFilename = "./private.pem";
int expiresInHours = 1;

ApiClient apiClient = new ApiClient(docuSignUrl);
apiClient.ConfigureJwtAuthorizationFlow(
    "IntegratorKey",
    "USER ID GUID",
    oauthBasePath,
    privateKeyFilename,
    expiresInHours);
AuthenticationApi authApi = new AuthenticationApi(apiClient.Configuration);
return authApi.Login();

我发现该线程显示了类似的错误,但似乎未解决

I have found this thread that shows the similar error but it doesn't seem resolved

更新05/07/2018:我已经验证了帐户中使用的域,但仍然收到相同的错误消息

Update 05/07/2018: I have validated the domain used in my account but I still get the same error message

更新05/11/2018:当我使用我的代码但替换了DocuSign单元测试中使用的IntegratorKey,UserID和私钥在这里,我的代码现在可以工作了!因此,我只能得出结论,问题不在于我的代码,而可能是DocuSign方面的配置问题?我是否需要以特定方式配置我的Integrator密钥?

Update 05/11/2018: When I use my code but that I replace the IntegratorKey, UserID and private key used in the DocuSign Unit Tests here, my code now works !? Hence, I can only conclude that the issue doesn't come from my code but maybe a configuration issue on the DocuSign side ? do I need to configure my Integrator Key a specific way ?

推荐答案

经过更多调查后,出现此类错误的原因是我在执行我的代码之前没有生成授权代码授予。
根据找到的信息此处,我必须执行以下HTTPRequest示例:

After more investigation, the reason with such an error is that I was not generating the Authorization Code Grant prior to executing my code. Based on the information found here, I had to perform the following HTTPRequest example :

GET /oauth/auth?
  response_type=token
  &scope=signature
  &client_id=YOUR_INTERGRATOR_KEY
  &state=a39fh23hnf23
  &redirect_uri=http://www.example.com/callback

一旦获得批准,我就可以成功运行代码。
最后,最初的错误消息确实具有误导性(我可能会认为这可能是错误?)。

Once it is approved, then I can run my code successfully. In the end, the initial error message is really misleading (I might argue it could be considered a bug ?).

这篇关于创建JWT令牌时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆