简体   繁体   English

我如何找出ASP.NET Web API访问令牌为何过期的原因?

[英]How can I figure out why ASP.NET web api access token expired?

I have a web service implemented by ASP.NET WEB API 2.0 and secure it with bearer token as as described in article here . 我有一个由ASP.NET WEB API 2.0实现的Web服务,并按照此处的文章所述,使用承载令牌来保护它。

And I set the expiry period to 180 days using code 我使用代码将有效期设置为180天

OAuthOptions = new OAuthAuthorizationServerOptions {
                TokenEndpointPath = new PathString("/Token"),
                Provider = new ApplicationOAuthProvider(PublicClientId),
                AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(30),
                AllowInsecureHttp = true
            };

However, I found that my token expired before 30 days end. 但是,我发现我的令牌在30天结束之前已过期。

How can I found why my token expired? 我如何找到我的令牌为何过期的原因? And what detail does the access token contain? 访问令牌包含哪些细节? How can I parse the bearer token? 如何解析不记名令牌?

I host my web server in Azure web apps. 我将Web服务器托管在Azure Web应用程序中。

Thanks. 谢谢。

You could use https://jwt.io/ to decode the bearer token once you have created one. 创建令牌后,您可以使用https://jwt.io/解码该承载令牌。

Examine the expiry date on the token matches what you are expecting. 检查令牌上的到期日期是否符合您的期望。

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

相关问题 如何在ASP.NET Web API中保存OAuth访问令牌 - How to save OAuth Access Token in ASP.NET Web API Asp.net MVC 4 Ajax发布请求不起作用,我不知道为什么 - Asp.net MVC 4 Ajax post request not working and I can't figure out why 铁路 ASP.NET 应用程序构建失败,我不明白为什么 - Railway ASP.NET app fails to build and I can't figure out why 验证ASP.NET Web API中的访问令牌 - Validating an access token in my ASP.NET Web API ASP.NET Core Web API,如何在启动类中访问 HttpContext - ASP.NET Core Web API, How can I access HttpContext in startup class 如何在ASP.NET上找出max_user_connections | MySQL应用程序? - How can i figure out a max_user_connections on ASP.NET | MySql application? Asp.net Web Api 2 - 如何从C#代码获取access_token - Asp.net Web Api 2 - how to get access_token from C# code ASP.NET Web API 和 OpenID Connect:如何从授权码获取访问令牌 - ASP.NET Web API and OpenID Connect: how to get Access Token from Authorization Code 如何从第三方访问令牌asp.net Web api2获取用户电子邮件? - How to get User Email from third party access token asp.net web api2? 如何在ASP.NET WEB API中验证由identityserver4生成的OpenID Connect访问令牌 - How to Validate OpenID Connect Access Token generated by identityserver4 in ASP.NET WEB API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM