Session expires after one hour. Renew access and refresh token
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
}
-
Hi ,
I don't have a suggestion for you here, however have you tried contacting Box Support to help you directly?
They may have a faster solution for you on a question like this.
-
Hi ,
Welcome to the Box Community and thanks for your first post in the forum!
Can you share this to Box User Services team so they can help investigate with you? Your post seems like it may require account specific information/configuration to help solve it.
You can contact Box Support and submit a case here to help you directly.
Please sign in to leave a comment.
Comments
2 comments