简体   繁体   English

在IdentityServer3中使用刷新令牌时获取NullReferenceException

[英]Getting NullReferenceException when using refresh token in IdentityServer3

When refreshing my token using the IdentityModel client library.... 使用IdentityModel客户端库刷新令牌时...

var result = _tokenClient.RequestRefreshTokenAsync (refreshToken).Result;

I'm getting a NullReferenceException. 我收到了NullReferenceException。 This doesn't happen every time after getting an AccessToken and RefreshToken but only after the tokens are hours old. 在获得AccessToken和RefreshToken之后,并不是每次都发生这种情况,而只是在令牌使用了几个小时之后才发生。 For example, I can get a AT and RT and consistently use the RT to get more AT and RT and it works fine. 例如,我可以获取一个AT和RT,并始终使用RT来获取更多的AT和RT,并且效果很好。 Let the code sit for a few hours and try to use the RT again and it throws the error. 让代码搁置几个小时,然后尝试再次使用RT,它会引发错误。 StackTrack is below. StackTrack在下面。 I would think if it was some sort of simple expiration issue I would have got a more graceful isError=true in the TokenResponse object. 我认为,如果这是某种简单的到期问题,我会在TokenResponse对象中得到更优雅的isError = true。

at IdentityModel.Client.TokenClientExtensions.Merge (IdentityModel.Client.TokenClient client, System.Collections.Generic.Dictionary`2 explicitValues, System.Object extra) [0x00016] in <filename unknown>:0 
  at IdentityModel.Client.TokenClientExtensions.RequestRefreshTokenAsync (IdentityModel.Client.TokenClient client, System.String refreshToken, System.Object extra, CancellationToken cancellationToken) [0x00024] in <filename unknown>:0 
  at SellMore.Functions.RefreshToken (System.String refreshToken) [0x0001d] in /Users/darrell/Mono Projects/SellMore/SellMoreApp/SellMore/SellMore/Classes/Functions.cs:41 

愚蠢的问题,我的_tokenClient变量为nul

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么identityserver3没有返回刷新令牌? - Why identityserver3 did not return refresh token? 在注销时不会删除IdentityServer3令牌 - IdentityServer3 Token Not Getting Deleted on Logout 使用没有密码的 IdentityServer3 生成访问令牌 - Generate access token with IdentityServer3 without password 使用IdentityServer3 + Entity Framework进行令牌验证 - Token validation with IdentityServer3 + Entity Framework IdentityServer在使用参考令牌时获得声明出现 - IdentityServer getting claims to appear when using reference token 如何使用自定义用户服务为identityserver3添加访问令牌的声明 - How to add claims to access token for identityserver3 using custom user service 使用.net 4.5与Identityserver3验证swagger - Authenticating swagger with identityserver3 using .net 4.5 在IdentityServer3上使用Kentor + Windows身份验证 - Using Kentor + Windows Authentication on IdentityServer3 IdentityServer3连接/令牌端点始终返回401:未授权 - IdentityServer3 connect/token endpoint always return 401: unauthorized IdentityServer3通过请求后的用户名和密码获取用户令牌 - IdentityServer3 get user token by username and password post REQUEST
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM