[英]Using Auth0.WinformsWPF, how do I obtain and use a refresh token?
Thanks for looking. 感谢您的光临。
I am developing an Outlook add-in that requires our users to obtain a token so that they may interact with our API. 我正在开发一个Outlook加载项,它要求我们的用户获取令牌,以便他们可以与我们的API交互。 We use Auth0 for this.
为此 ,我们使用Auth0 。
Essentially, when the user attempts to use a feature from our add-in, they are presented with a sign-in dialog that is powered by Auth0's Auth0.WinformsWPF nuget package (if they are not yet authenticated): 本质上,当用户尝试使用外接程序中的功能时,会显示一个登录对话框,该对话框由Auth0的Auth0.WinformsWPF nuget软件包提供支持(如果尚未进行身份验证):
Of course, our users do not care to sign in to our API every time the token expires so I need to make use of Auth0's Refresh Token so that if our code attempts to call the API but the token is expired, I can refresh it without asking the user to log back in. 当然,我们的用户不必在每次令牌过期时都登录到我们的API,因此我需要使用Auth0的刷新令牌,这样,如果我们的代码尝试调用API但令牌已过期,则我可以刷新它而无需要求用户重新登录。
I do not see an obvious way to obtain or make use of the refresh token using Auth0.WinformsWPF package. 我看不到使用Auth0.WinformsWPF软件包获取或使用刷新令牌的明显方法。 Launching the above dialog to obtain a token is pretty simple however:
但是,启动上述对话框以获得令牌非常简单:
auth0.LoginAsync(wrapper, "","openid name email email_verified picture given_name family_name sso").ContinueWith(t => {
//Callback logic after successful authentication.
},
TaskScheduler.FromCurrentSynchronizationContext())
Preferably using Auth0.WinformsWPF , how do I obtain and use a refresh token? 最好使用Auth0.WinformsWPF ,如何获取和使用刷新令牌? I would very much appreciate some example code.
我非常感谢一些示例代码。
You need to add the offline_access
parameter to scope
. 您需要将
offline_access
参数添加到scope
。 That will instruct Auth0 to return a refresh_token
这将指示Auth0返回
refresh_token
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.