onedrive - How to refresh token from a windows service? -
is possible refresh token if application not have access browser control or http context? have winform logs user in , gets consent, passes token windows service files can uploaded onedrive. when token expires, seems methods refreshing token require callback url.
you can if you've requested wl.offline_access
scope , you're using authorization code grant flow in oauth 2.0. once user has logged in through oauth, you'll receive access_token
valid 1 hour, , refresh_token
, valid long time.
each time service needs work on user's behalf, can redeem refresh_token
new access_token
, refresh_token
, , use access_token
work. make sure save new refresh_token
well, make sure extend expiration.
this way can have service performs actions on behalf of user long time, without needing user sign in again. however, possible refresh_token
expire or become invalid, need handle situations unable redeem refresh_token
.
Comments
Post a Comment