Skip to content

Commit 7c712c8

Browse files
committed
add api client auth section to profile user guide
1 parent e32ac56 commit 7c712c8

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

docs/userguides/profile.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
Use the [code42 profile](../commands/profile.md) set of commands to establish the Code42 environment you're working
44
within and your user information.
55

6-
First, create your profile:
6+
## User token authentication
7+
8+
Use the following command to create your profile with user token authentication:
79
```bash
810
code42 profile create --name MY_FIRST_PROFILE --server example.authority.com --username [email protected]
911
```
@@ -15,6 +17,19 @@ Your password is not shown when you do `code42 profile show`. However, `code42 p
1517
password exists for your profile. If you do not set a password, you will be securely prompted to enter a password each
1618
time you run a command.
1719

20+
## API client authentication
21+
22+
Once you've generated an API Client in your Code42 console, use the following command to create your profile with API client authentication:
23+
```bash
24+
code42 profile create-api-client --name MY_API_CLIENT_PROFILE --server example.authority.com --api-client-id "key-42" --secret "code42%api%client%secret"
25+
```
26+
27+
```{eval-rst}
28+
.. note:: Remember to escape special characters in your API client secret like `!` with a backslash. ex: `"my!secret"` should be passed in as `"my\!secret"`
29+
```
30+
31+
## View profiles
32+
1833
You can add multiple profiles with different names and the change the default profile with the `use` command:
1934

2035
```bash

src/code42cli/profile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def set_password(new_password, profile_name=None):
169169
"\tcode42 profile create-api-client "
170170
"--name <profile-name> "
171171
"--server <authority-URL>"
172-
"--api-key <api-key> "
172+
"--api-client-id <api-client-id> "
173173
"--secret <api-client-secret>\n",
174174
bold=True,
175175
)

tests/test_profile.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ def test_create_profile_when_api_client_uses_expected_profile_values(config_acce
160160
config_accessor.get_profile.side_effect = NoConfigProfileError()
161161
profile_name = "profilename"
162162
server = "server"
163-
api_key = "key-42"
163+
api_client_id = "key-42"
164164
ssl_errors_disabled = True
165165
cliprofile.create_profile(
166-
profile_name, server, api_key, ssl_errors_disabled, False, True
166+
profile_name, server, api_client_id, ssl_errors_disabled, False, True
167167
)
168168
config_accessor.create_profile.assert_called_once_with(
169-
profile_name, server, api_key, ssl_errors_disabled, False, True
169+
profile_name, server, api_client_id, ssl_errors_disabled, False, True
170170
)
171171

172172

0 commit comments

Comments
 (0)