简体   繁体   English

访问令牌过期时使用刷新令牌

[英]Use Refresh Token When Access Token is Expired

I'm using OAuth in .Net-Core 2.1 to Login to Coinbase, I've configured my authenticaton like so: 我在.Net-Core 2.1中使用OAuth登录到Coinbase,我已经按照如下方式配置了我的身份验证:

services.AddAuthentication(COOKIE_AUTH)
    .AddCookie(options => options.ExpireTimeSpan = TimeSpan.FromMinutes(60))
    .AddCoinbase(options => {
        options.SendLimitAmount = 1;
        options.SendLimitCurrency = "USD";
        options.SendLimitPeriod = SendLimitPeriod.day;
        options.ClientId = Configuration["Coinbase:ClientId"];
        options.ClientSecret = Configuration["Coinbase:ClientSecret"];
        COINBASE_SCOPES.ForEach(scope => options.Scope.Add(scope));
        options.SaveTokens = true;
        options.ClaimActions.MapJsonKey("urn:coinbase:avatar", "avatar_url");
    });

Using Postman I see that I'm getting an access token and a refresh token. 使用邮递员,我看到我正在获取访问令牌和刷新令牌。 My token expires within two hours and never refreshes. 我的令牌会在两个小时内过期,并且永不刷新。

I know I can manually refresh the token, but I would expected this to be build into .net some where 我知道我可以手动刷新令牌,但是我希望可以将其内置到.net中

Is there a way to refresh my token built into .net? 有没有办法刷新内置在.net中的令牌?

This doesn't make sense since the client is responsible for sending a valid token in order to expect the request to be authorized. 这没有任何意义,因为客户端负责发送有效令牌以期望请求得到授权。 When clients typically send tokens , they typically do so in a header. 当客户端通常发送令牌时,它们通常在标头中发送令牌。 That header only contains a single access token, not a refresh token. 该标头仅包含一个访问令牌,而不包含刷新令牌。 Instead the refresh token is persisted at the client and used to get an access token that IS valid. 取而代之的是,刷新令牌在客户端保留,并用于获取有效的访问令牌。 Then it can make a different request and expect a different outcome. 然后,它可以提出不同的请求并期望得到不同的结果。 The flow is important. 流量很重要。

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

相关问题 使用JWT令牌使访问令牌过期时刷新令牌调用 - Refresh Token call when Access token expired using JWT token 刷新令牌在访问令牌后立即过期 - Refresh token expired as soon as access token OWIN ASP.NET-如果访问令牌过期,则无法使用刷新令牌生成访问令牌 - OWIN ASP.NET - Cant generate Access Token using Refresh Token if Access Token is expired 来自ARM的访问令牌在收到时已过期 - Access token from ARM expired when received 访问令牌已过期,但我们无法刷新它 - The access token has expired but we can't refresh it exception 刷新过期令牌 Web API - Refresh expired token Web API 如何刷新访问令牌 - How to refresh access token 如何使用已使用V2模型保存在数据库中的令牌缓存登出到Office 365,刷新过期的访问令牌? - How to refresh the expired access token with out login to office 365 using token cache already saved in a database using V2 model? JWT 访问令牌与刷新令牌(创建) - JWT access token vs refresh token (creating) 刷新失败,并显示403禁止错误。 刷新令牌已撤消或过期 - Refresh failed with a 403 Forbidden error. The refresh token was revoked or expired
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM