nodejs - how to refresh the token with the SDK
I'm new to Box node sdk and wrote a simple nodejs app using box sdk (oAuth) to upload files. Everything works but the tokens expire after an hour.
{ accessToken: 'xxx',
refreshToken: 'YPQxTLtCRpOPMnKrt31cuisdFrtHILdxxxxxxxhkelhR2uSbJxo',
accessTokenTTLMS: 3980000,
acquiredAtMS: 152***phone number removed for privacy*** }
when I call the SDK functions after an hour, I get
get Error = undefined
uncaughtException: Unexpected API Response [401 Unauthorized]
Looks like I need to refresh the token every hour. I'm using getPersistentClient and thought that the SDK will auto refresh the tokens.
const client = sdk.getPersistentClient(boxtoken);
Can someone give me pointers on how to auto refresh the tokens without the end user intervention of re-authenticating my app ?
Thank you
サインインしてコメントを残してください。
コメント
0件のコメント