Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ozhelezniak-talend opened this issue Oct 14, 2022 · 4 comments
Assignees
Labels
enhancement Added to issues that describes enhancements

Comments

@ozhelezniak-talend
Copy link

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

@lukaszsocha2
Copy link
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

@ozhelezniak-talend
Copy link
Author

ozhelezniak-talend commented Oct 14, 2022

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);
        }

@lukaszsocha2
Copy link
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

@lukaszsocha2
Copy link
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
Labels
enhancement Added to issues that describes enhancements
Projects
None yet
Development

No branches or pull requests

7 participants