Reputation: 24218
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. We use Auth0 for this.
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):
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.
I do not see an obvious way to obtain or make use of the refresh token using Auth0.WinformsWPF package. 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? I would very much appreciate some example code.
Upvotes: 0
Views: 302
Reputation: 14212
You need to add the offline_access
parameter to scope
. That will instruct Auth0 to return a refresh_token
Upvotes: 1