Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Refresh owner user/copilot Gitlab access token automatically when needed #450

Merged
merged 1 commit into from
May 25, 2022

Conversation

gets0ul
Copy link
Collaborator

@gets0ul gets0ul commented May 25, 2022

@gets0ul gets0ul requested a review from jmgasper May 25, 2022 12:13
@52cs
Copy link
Collaborator

52cs commented May 25, 2022

@gets0ul Good bug fix!
But the topcoder-x-processor will also need to use the owerUser's access_token. You should also call refreshGitlabUserAccessToken in topcoder-x-processor whenever the user token is used.

Even this way, the access_token will also expired if the use interval of the access_token is larger than 2 hours.

const setTimeoutRefreshGitlabUserAccessToken = () => {
    refreshGitlabUserAccessToken();
    setTimeout(() => setTimeoutRefreshGitlabUserAccessToken, 3600*2-300);
};

The most elegant way should be add setTimeout(() => setTimeoutRefreshGitlabUserAccessToken, 3600*2-300); at the end of ownerUserLoginCallback.

@gets0ul
Copy link
Collaborator Author

gets0ul commented May 25, 2022

@52cs It's fine, I think. No need to use setTimeout to do it periodically as refresh_token can always be used even if access_token is already expired.

@52cs
Copy link
Collaborator

52cs commented May 25, 2022

@gets0ul

  1. refresh_token also has expired time.
  2. When process Issue related events in topcoder-x-processor, refreshGitlabUserAccessToken does not called.

@jmgasper jmgasper merged commit 54055a2 into topcoder-archive:develop May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants