Sign in option for non-python users #7
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds the ability to sign in users directly through the extension using a loopback oauth flow, saving the refresh token as a secret, as well as the ability to sign out (removing the account information from the extension). To accommodate for this option, some internal changes were necessary.
Here are some screenshots of the process:
If the user cancels the sign in, an error message is displayed:
Here's a preview of the new look for the account picker:
Here's an overview of the changes:
EETasksPanel.renderandscriptRunnerAsAccountis now of typeIPickedAccount {name:string, kind:string}instead of simplystring. This is because thegetTokenmodule, specifically thenewTokenfunction now relies onkindto determine how to retrieve a new token. This change is propagated in all necessary functions within those modules.userAccountsas {account:token} (key:value) pairs. The structure ofuserAccountsis nowIAccounts{[name:string]:IAccount}, whereIAccount{kind:string, token: string | null}. Again, this is to accommodate the differences betweengcloudaccounts, the persistent credentials from the python earthengine-api, and the new signed-in accounts.gcloud. When updating accounts through theUpdate available accountscommand, if an account already exists with kindSigned in, it is not added as another account. When a new account is signed in, the account is saved with kindSigned in, replacing any existing account of the same name.vscode.QuickPickItemKind.Separatorare added so that they get displayed in the list.kindinformation within thelabelin the quickpick item itself so that it can be retrieved once the account is picked (and finally pass theIPickedAccountobject to the callback function).$(account)for Signed-in accounts.$(snake)for python earthengine-api credentials$(terminal-view-icon)for gcloud accounts.defaultAccountanddefaultProjectis now removed from the extension configuration. Instead, a newPick default accountcommand lets the user pick the account and project to set as the default, which are stored in the extension context.Sign outcommand was added, which lets the user pick the account to sign-out from, deleting the account fromuserAccounts, as well as the secret refreshToken for that account.