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

[desktop] Add Gitpod to Settings sync #139

Closed
wants to merge 43 commits into from

Conversation

filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Oct 5, 2021

Add Gitpod as an authentication and Settings Sync provider via the gitpod.gitpod-desktop extension.

  • invalidate bad token(s) on startup (27f4c9c)
  • fix the openExternal issue
  • implement code exchange
  • Fix 401 WS Error
  • contribute Gitpod endpoint config to the manifest

Blocked by gitpod-io/gitpod#6272

@akosyakov
Copy link
Member

@filiptronicek Could you squash in one commit and rebase on gp-code/main? I tried to but did not figure out what is the first commit and which changes should be applied during rebase.

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks promising, but the code structure needs more love. Also I could not find how we invalidate existing tokens. It would be nice to align in these regards with GH auth extension.

extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/registerAuth.ts Outdated Show resolved Hide resolved
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, forgot to publish comments several days ago (

extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
if (!enabled) {
try {
await config.update('configurationSync.store', undefined, true);
updateSyncContext();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not do it here, but listern to configuration changes and react it.

setSettingsSync should only update config nothing else, side effects should be done via listeners

extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved

// Wait until a session is added to the context's secret store
const authPromise = promiseFromEvent(context.secrets.onDidChange, (changeEvent: vscode.SecretStorageChangeEvent, resolve, reject): void => {
if (changeEvent.key !== 'gitpod.authSessions') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please introduce a class GitpodAuthSession which provides methods to set/get/delete and event to indicate when it is changed. gitpod.authSessions should be a constant within such class and not used by the rest of code

extensions/gitpod/src/auth.ts Show resolved Hide resolved
Copy link

@bigint bigint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some lil typo fixes 😄

extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
extensions/gitpod/src/auth.ts Outdated Show resolved Hide resolved
geropl and others added 8 commits March 30, 2022 19:33
Related to gitpod-io/gitpod#7360

Currently, When the server has a root cert cross-signed by the
expired `DST ROOT CA X3`. There's a possiblity of the client having
an older version of `electron` in their code that causes the cert
expiry failure.

While, asking users to update their vs code should be our first
suggestion, In some cases using the latest version of `node-fetch`
also fixed the issue (not exactly sure why). This PR bumps the
`node-fetch` dependency to the one that the `code-server` uses.

Signed-off-by: Tarun Pothulapati <tarun@gitpod.io>
jeanp413 and others added 13 commits April 4, 2022 09:26
refactor `createOauth2URL`

Add lock changes

Rewrite `getSessions` and `removeSession` functions

Don't bore the user with expired error

Docs

Add todo

Add get and set functions for stored auth sessions

Change oauth2 creation function and update clientID to be up to date

Have popup preference stored in the global context

Handle ws errors

Max WS retries
Co-authored-by: bigint <b1gint@protonmail.com>
Co-authored-by: bigint <b1gint@protonmail.com>
Co-authored-by: bigint <b1gint@protonmail.com>
@jeanp413
Copy link
Member

continuation in #337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.