From ecc492c3eaac3e443883ca2f6dcc12d58cd2476c Mon Sep 17 00:00:00 2001 From: PeterSchafer Date: Mon, 26 Aug 2024 10:25:30 +0000 Subject: [PATCH] docs: synchronizing help from snyk/user-docs --- help/cli-commands/auth.md | 22 ++++++++++++ help/cli-commands/config-environment.md | 48 +++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 help/cli-commands/config-environment.md diff --git a/help/cli-commands/auth.md b/help/cli-commands/auth.md index bcf380bc1d..3d77c88d40 100644 --- a/help/cli-commands/auth.md +++ b/help/cli-commands/auth.md @@ -12,6 +12,28 @@ Running `$ snyk auth` opens a browser window with prompts to log in to your Snyk When you have authenticated, you can start using the CLI; see [Getting started with the CLI](https://docs.snyk.io/snyk-cli/getting-started-with-the-cli) +**Note:** Beginning with version 1.1293, the Snyk CLI uses OAuth when authenticating through the browser. + +OAuth provides improved security by issuing shorter-lived expiring authorizations with the convenience of automatic refresh. + +Earlier versions of the Snyk CLI (< 1.1293) obtained a non-expiring API token through a legacy browser interaction. + +This authentication method is deprecated but you may use it in the event of problems with OAuth by running `snyk auth --auth-type=token`. A future release of the CLI will remove this option. + +## Options + +### `--auth-type=` + +Specify the \ of authentication to use. Supported types are `oauth` (the default beginning with version 1.1293.0) AND `token`. + +### `--client-secret=` + +### `--client-id=` + +You can set the client secret and the id can be set in order to use the [OAuth2 Client Credentials Grant](https://docs.snyk.io/enterprise-configuration/service-accounts/service-accounts-using-oauth-2.0#oauth-2.0-with-client-secret) + +Both values must be provided together. They are only valid together with `--auth-type=oauth;`otherwise they will be ignored. + ## Value In some environments and configurations, you must use the ``; see [Authenticate the CLI with your account](https://docs.snyk.io/snyk-cli/authenticate-the-cli-with-your-account) diff --git a/help/cli-commands/config-environment.md b/help/cli-commands/config-environment.md new file mode 100644 index 0000000000..7ff666e557 --- /dev/null +++ b/help/cli-commands/config-environment.md @@ -0,0 +1,48 @@ +# Config environment + +**Note:** This command will be available as of CLI version 1.1293.0. + +## Usage + +`snyk config environment ` + +## Description + +The `snyk config environment` command is provided for your convenience to make changing the endpoint used in the CLI easier and safer. + +The outcome is almost the same as `snyk config set endpoint=` but in addition, the `snyk config environment` command does the following: + +- Supports aliases for environments to avoid the use of full URLs +- Performs basic checks to avoid ambiguous or unexpected configuration +- Clears existing authentication and organization settings, which are expected to be environment-specific + +## Debug + +Use the `-d` option to output the debug logs. + +## Option + +`--no-check` + +Skip the basic checks for ambiguous or unexpected configuration. + +Use only if the reported configuration issues are intentional and can be ignored. Otherwise, the configuration might not work as expected. + +## Supported environment URLs mappings + +- default => https://api.snyk.io +- SNYK-US-01 => https://api.snyk.io +- SNYK-US-02 => https://api.us.snyk.io +- SNYK-AU-01 => https://api.au.snyk.io +- SNYK-EU-01 => https://api.eu.snyk.io +- SNYK-GOV-01 => https://api.snykgov.io + +## Examples + +``` +snyk config environment default +snyk config environment SNYK-EU-01 +snyk config environment SNYK-AU-01 +snyk config environment SNYK-AU-01 --no-check +snyk config environment https://api.eu.snyk.io +```