Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

JWT Token refresh / timeout

New post

Comments

1 comment

  • kendomen

    I believe the default is around 60 minutes.

     

    I've been using the SDK so there seems to be wrappers around token management.  For example:

    public static BoxDeveloperEditionAPIConnection getAppEnterpriseConnection(String enterpriseId, String clientId,
                String clientSecret, JWTEncryptionPreferences encryptionPref, IAccessTokenCache accessTokenCache) {
    
            BoxDeveloperEditionAPIConnection connection = new BoxDeveloperEditionAPIConnection(enterpriseId,
                    DeveloperEditionEntityType.ENTERPRISE, clientId, clientSecret, encryptionPref, accessTokenCache);
    
            connection.tryRestoreUsingAccessTokenCache();
    
            return connection;
        }

    but if you don't use the SDK, I do both.  I check to see if token has expired and I also wrap it in a try/catch for 401 errors.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.