Skip to content

Make "expiration time" to be configurable in BoxDeveloperEditionAPIConnection #1114

Description

@ozhelezniak-talend

Is your feature request related to a problem? Please describe.

For people with a bad internet connection, 30 seconds might be not enough to acquire a token.
As a workaround, we can increase max attempts but maybe increasing the count of an expiration time for claims would be more efficient.

Describe the solution you'd like

Frankly, I don't like BoxGlobalSettings with statics variables, but it might be the solution. (with the additional setter in BoxDeveloperEditionAPIConnection) the same thing as we have for maxRetryAttemps.

Describe alternatives you've considered

Increase the max retry attempts and cross your fingers.

Additional context

Activity

  1. lukaszsocha2 commented on Oct 14, 2022

    @lukaszsocha2
    Contributor

    Hi @ozhelezniak-talend,
    I assume you using OAuth2 authentication type and you are referring to the expiration time of "short-lived authorization code" described here. If not please describe your issue with more details.
    The expiration time of "short-lived authorization code" is defined in authentication server and it is not possible to change this setting by client (SDK). If this is a problem you can also try another authentication methods: JWT or Client Credentials Grant.
    @lukaszsocha2

  2. ozhelezniak-talend commented on Oct 14, 2022

    @ozhelezniak-talend
    Author

    Hello @lukaszsocha2
    Sorry for the lack of details.
    I'm using JWT authentication method.

    BoxDeveloperEditionAPIConnection.getUserConnection(userId, boxConfig, null)
    

    And when it tries to establish connection a bit deeper into stacktrace

    connection.tryRestoreUsingAccessTokenCache();
    

    it calls method

    this.authenticate();
    

    inside it contains those lines

                // Reconstruct the JWT assertion, which regenerates the jti claim, with the new "current" time
                jwtAssertion = this.constructJWTAssertion(jwtTime);
    

    where inside constructJWTAssertion you can find this hardcoded 30 seconds period

            if (now == null) {
                claims.setExpirationTimeMinutesInTheFuture(0.5f);
            } else {
                now.addSeconds(30L);
                claims.setExpirationTime(now);
            }
    
  3. lukaszsocha2 commented on Oct 14, 2022

    @lukaszsocha2
    Contributor

    Hi @ozhelezniak-talend,
    now it is much more clear what you mean :). I will discuss the change with the team, but I believe we can make that configurable with the next release. I'll let you know what we decided.
    @lukaszsocha2

  4. lukaszsocha2 commented on Oct 17, 2022

    @lukaszsocha2
    Contributor

    Hi,
    we created internal ticket to address your request (SDK-2704). We will plan it and resolve as soon as our schedule will allow for it.
    Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementAdded to issues that describes enhancements

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions