Skip to main content
Question

Cannot keep Integration Connected

  • May 22, 2025
  • 7 replies
  • 26 views

Forum|alt.badge.img

Hello,

 

We integrate with box.com from our platform so we can send our files to it. However, it keeps turning off/losing its authorization and we have to re-enable and reauthorize. It will work for awhile, then turn off/lose connection. 

 

Any idea what could be going on or where we should look to figure out whats going on?

7 replies

Forum|alt.badge.img

I would like to add that this seems to happen when many documents are transferred over during a period. Is there perhaps an API Limit that we are hitting?


Forum|alt.badge.img

Hi ,

 

Could you share the error that you're getting when the connections start to fail? Based on what you've said my guess is that your access token is expiring. Tokens will only last for about an hour and then need to be refreshed. It could be that the token is expiring during the transfer period. 

 

- Jon


Forum|alt.badge.img

Hi Jon,

 

The error is: 

Box.V2.Exceptions.BoxSessionInvalidatedException
 
The integration seems to only come unlinked during the transfer of documents. 

Forum|alt.badge.img

Hi ,

 

Take a look at these two threads on the issue to see if they might match your integration:


Forum|alt.badge.img

Hi Jon,

 

//     An exception to represent that the current access/refresh tokens are in an unrecoverable
    //     state. This can either be due to the tokens being revoked or expired. A new session
    //     must be created by going through the OAuth workflow again
 
So this seems to be the issue. 

Forum|alt.badge.img

Hello,

Thank you for the ideas  

We are storing and supplying the AccessToken and RefreshToken as such:

var auth = new OAuthSession(userProfile.BoxSettings.AccessToken, userProfile.BoxSettings.RefreshToken, userProfile.BoxSettings.ExpiresInSeconds, userProfile.BoxSettings.TokenType);

 

We know this to be working because in our own testing, the connection stays linked for weeks now without issue, so certainly the token is refreshing.

 

We have one client in particular who's connection will throw BoxSessionInvalidatedException.

 

Is this the exception we should expect if the session is cleared from their Box.com site, and if so is there any way we can discern that this is what happened?

If we are supplying the appropriate AccessToken and RefreshToken, in what scenarios can this exception still throw?

Thank you,

Ian


Forum|alt.badge.img

Hi ,

 

Honestly as far as I know the token should not become invalidated from a user step, unless say the user access was locked down (account decommissioning). It doesn't look like folks are reporting any issues with the token services, so that appears to be working correctly. 

 

I wish I could provide more here, but I would just suggest listening for those errors to be returned and force a manual refresh of the token when it does.

 

- Jon