Skip to content

4879: Remove the flow of forcing to create VSCode's GitHub authentication #4881

@sergeibbb

Description

@sergeibbb

Summary

This is a subtask of #4879.

In this ticket:

  • our cloud integrations stop forcing to create new VSCode session in GitHub
  • When both Cloud and VSCode sessions is available the Cloud one is used
  • If only VSCode session is available it's used
  • If VSCode session is not valid, then "Reauthenticate" button appears that sends user through the Cloud connecting flow.
  • File System features on web keep working through VSCode's session

This, hopefully, fixes the original problem reported in slack. On the other hand it should not disconnect users who used local session, because we keep using it if it's available.
So I suggest we merge it here and discuss further actions in #4882

Explanation

Before, the following happens on GitHub authentication

  1. We try to receive VSCode's GitHub token
    • if it exists and valid use it
    • if it exists and expired, reauthenticate in VSCode with force flag.
  2. If VSCode's token does not exist authenticate in GKDev and get token from there

Now, we do the following:

  1. Check if GKDev token exists
    • if exists and valid use it
    • Authenticate / re-authenticate in GKDev if it's needed
  2. if GKDev token does not exists look at VSCode session
    • if it's available and valid use it
    • never ask for new VSCode session in Cloud conneciton flow.

By doing that we make sure that we never create new VSCode's tokens, we only use it if we have never used GKDev and have a valid VSCode token

Steps to reproduce

Issue 1. Recreating VSCode GitHub session

  1. Authorize GitLens using VSCode's session
  2. Connect rich GitHub integration using VSCode's session
  3. Go to GitHub.com authorized applications settings and revoke the VSCode application
  4. In GitLens to to commits view and try to expand some commits
  5. Eventually you get a "Reauthenticate" message and the following in logs:
    Error: Your 'github' credentials are either invalid or expired
    
  6. Click "Reauthenticate"

Actual result

  • It sends you through the VSCode's authentication flow

Expected result

  • It should send you trough the GKDev's authentication flow

Issue 2. Skipping GKDev authentication flow

(Possibly addressing the initial problem)

  1. Fix "Issue 1".
  2. Make sure to sign out GKDev in GitLens
  3. Authorize GitLens using VSCode's session
  4. Connect rich GitHub integration using VSCode's session
  5. Go to GitHub.com authorized applications settings and revoke the VSCode application4. In GitLens to to commits view and try to expand some commits
  6. Eventually you get a "Reauthenticate" message and the following in logs:
    Error: Your 'github' credentials are either invalid or expired
    
  7. Click "Reauthenticate"

Actual result

  • Nothing happens

Expected result

  • It should send you trough the GKDev's authentication flow

Issue 3. Ignoring GKDev authentication results

  1. Fix "Issue 1" and "Issue 2"
  2. Authorize GitLens using VSCode's session
  3. Connect rich GitHub integration using VSCode's session
  4. Go to GitHub.com authorized applications settings and revoke the VSCode application4. In GitLens to to commits view and try to expand some commits
  5. Eventually you get a "Reauthenticate" message and the following in logs:
    Error: Your 'github' credentials are either invalid or expired
    
  6. Click "Reauthenticate"
  7. It sends you trough the GKDev's authentication flow

Actual result

  • You do not see practical results of the flow. You stay unauthorized in GitHub using the revoked token
  • If you reload the window you'll see the "Reauthenticate" message again.

Expected result

  • GitHub integration should start working
  • You should stop seeing "Reauthenticate" messages.

Verification steps

Main verification flow:

  1. Before the update (in the release version): authorize GitLens using VSCode's session
  2. Update to the pre-release
  3. GitLens should keep being authorized
  4. Follow steps 3-6 from the "Issue 1" section.
  • (Issue 1 and 2) On "Reconnect" you should stop being able to connect to the VSCode's session, it should always pass you through the GKDev flow.
  • (Issue 3) You should see practical results of authorizing through GKDev. GitHub integration should start working immediately.
  • (Issue 3) "Reauthenticate" messages should stop appearing after you reload the window

Also test on Web environment:

  • Check that issues 1, 2, and 3 are fixed.
  • Check that filesystem features keep working

Test with local integrations (GitHub)

  1. Set setting "gitlens.cloudIntegrations.enabled" to false
  2. Go through the main verification flow.
  • I should use your VSCode's session and be able to recreate it using VSCodes authentication flow.
    • It should not go to GKDev

Test with local integrations (GitHub)

  1. Set setting "gitlens.cloudIntegrations.enabled" to false
  2. Open a GitLab repo, go to "Remotes" View.
  3. Click "connect" on a GitLab remote.
  • You should see the PAT input box. Use PAT to connect. Check that the integration works
  1. Revoke the token in GitLab settings. Use GitLens
  2. You see "Reauthenticate" GitLab pop-up and an error in GitLens output.
  3. Click "Reauthenticate"
  • You should see the PAT input box again. It does not lead you through GKDev flow.
  • Enter a new PAT token. Everything should start working again. No more auth pop-ups.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions