c# - How to get refresh token of Box -


i have c# desktop application uploads files box, needs refresh token generate access token, i'm unable create refresh token programmatically. created refresh token this site , uploaded files box refresh token expired after minutes , throws exception refresh token has expired. i'm using box-csharp-sdk-v2.

so want create refresh token using client details or api key programaticaly

in order work box oauth2 tokens, you'll need instantiate tokenprovider using api key , secret application:

// instantiate token provider. var tokenprovider = new tokenprovider("apikey", "apisecret"); 

after sending user through oauth2 workflow receive authorization code. tokenprovider can use code fetch first access/refresh token pair:

// fetch initial access/refresh token pair // want persist these new values later use. var initialtokenpair = tokenprovider.getaccesstoken("code") 

a new refresh token given every time refresh access token. refresh token expires when used, or after ~60 days, whichever comes first.

// refresh token pair. // want persist these new values later use. var newtokenpair = tokenprovider.refreshaccesstoken("refreshtoken"); 

i updated box-csharp-sdk-v2 readme above example. i'm sorry wasn't made clear prior now!

edit: added example fetching initial token pair.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -