che-server icon indicating copy to clipboard operation
che-server copied to clipboard

Skip refresh GitHub tokens, override refresh Azure DevOps token request

Open vinokurig opened this issue 1 year ago • 2 comments

What does this PR do?

  • Return existed token on GitHub token refresh request. GitHub Oauth tokens do not have expiration date, so no need to refresh them. Refresh token request will fail for such tokens because they do not have expires_in value, see: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens#refreshing-a-user-access-token-with-a-refresh-token
  • Override the refreshToken function for Azure DevOps. The existed refresh function from the oauth2 package fails because Azure DevOps supports POST requests in application/x-www-form-urlencoded format only.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

fixes https://github.com/eclipse-che/che/issues/23028

How to test this PR?

see https://github.com/eclipse-che/che/issues/23028 Same steps are relevant for Azure DevOps

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

vinokurig avatar Jul 10 '24 14:07 vinokurig

/retest

vinokurig avatar Jul 19 '24 11:07 vinokurig

/retest

vinokurig avatar Jul 22 '24 06:07 vinokurig

Verified on Eclipse Che with quay.io/eclipse/che-server:pr-699 - the functionality works properly.

artaleks9 avatar Jul 24 '24 06:07 artaleks9

/retest

vinokurig avatar Jul 24 '24 11:07 vinokurig

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: artaleks9, ibuziuk, tolusha, vinokurig

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Jul 24 '24 13:07 openshift-ci[bot]

Build 3.16 :: server_3.x/349: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/7308 triggered

devstudio-release avatar Jul 25 '24 10:07 devstudio-release

Build 3.16 :: update-digests_3.x/7137: UNSTABLE

No new images detected: nothing to do!

devstudio-release avatar Jul 25 '24 10:07 devstudio-release