Hello,
I have a problem with box integration. after one hour my connectivity with box stopped working for 10-15 minutes and then it works back. This is the way I refresh access token.
I am using BOX.V2 2.6.2 nuget version.
Thanks.
string accesToken = encryptionService.Decrypt(boxCredential.AccesToken);
string refreshToken = encryptionService.Decrypt(boxCredential.RefreshToken);
var oAuthSession = new OAuthSession(accesToken, refreshToken, boxCredential.ExpiresIn, "bearer");
IBoxConfig boxConfig = new BoxConfig(consumerKey, consumerSecret, null);
BoxClient boxClient = new BoxClient(boxConfig, oAuthSession);
//credentials expired
if (oAuthSession.ExpiresIn < (DbTimestamp.Now - boxCredential.UpdatedOn).TotalSeconds)
{
oAuthSession = AsyncHelpers.RunSync(async () => await boxClient.Auth.RefreshAccessTokenAsync(oAuthSession.AccessToken));
//store the new tokens in the database
}