You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
oauth via plauth lib for main 3.0 dev branch (#1121)
Initial merge of OAuth via the planet auth library for the SDK.
This deeply changes the planet.Auth class and the CLI functions related to auth, but should be pretty light on the rest of the SDK.
Copy file name to clipboardExpand all lines: docs/cli/cli-guide.md
+17-23
Original file line number
Diff line number
Diff line change
@@ -34,13 +34,13 @@ Yes. Even if you’re not writing code—and only using the "no code" CLI part o
34
34
Install the Planet SDK for Python using [pip](https://pip.pypa.io):
35
35
36
36
```console
37
-
$ pip install planet
37
+
pip install planet
38
38
```
39
39
40
40
## Step 3: Check the Planet SDK for Python version
41
41
42
42
```console
43
-
$ planet --version
43
+
planet --version
44
44
```
45
45
46
46
You should be on some version 2 of the Planet SDK for Python.
@@ -55,46 +55,40 @@ To confirm your Planet account, or to get one if you don’t already have one, s
55
55
56
56
### Authenticate with the Planet server
57
57
58
-
Just as you log in when you browse to https://account.planet.com, you’ll want to sign on to your account so you have access to your account and orders.
58
+
Just as you log in when you browse to https://planet.com/account, you’ll want to sign on to your account so you have access to your account and orders.
59
59
60
60
At a terminal console, type the following Planet command:
61
61
62
62
```console
63
-
$ planet auth init
63
+
planet auth login
64
64
```
65
65
66
-
You’ll be prompted for the email and password you use to access [your account](https://account.planet.com). When you type in your password, you won’t see any indication that the characters are being accepted. But when you hit enter, you’ll know that you’ve succeeded because you’ll see on the command line:
66
+
A browser window should be opened, and you will be directed to login to your account. This
67
+
command will wait for the browser login to complete, and should exit shortly afterwards.
68
+
When this process succeeds, you will see the following message on the console:
67
69
68
70
```console
69
-
Initialized
71
+
Login succeeded.
70
72
```
71
73
72
-
### Get your API key
73
-
74
-
Now that you’ve logged in, you can easily retrieve your API key that is being used for requests with the following command:
75
-
74
+
If you are in an environment where the `planet` command line utility cannot open a browser (such
75
+
as a remote shell on a cloud service provider), use the following command and follow the instructions:
76
76
```console
77
-
planet auth value
77
+
planet auth login --no-open-browser
78
78
```
79
79
80
-
Many `planet` calls you make require an API key. This is a very convenient way to quickly grab your API key.
81
-
82
-
#### Your API Key as an Environment Variable
80
+
### Get your Access Token
83
81
84
-
You can also set the value of your API Key as an environment variable in your terminal at the command line:
82
+
Now that you’ve logged in, you can easily retrieve an Access Token that is being used for requests with the following command:
85
83
86
84
```console
87
-
export PL_API_KEY=<your api key>
85
+
planet auth print-access-token
88
86
```
89
87
90
-
And you can see that the value was stored successfully as an environment variable with the following command:
91
-
92
-
```console
93
-
echo $PL_API_KEY
94
-
```
88
+
Many `planet` calls you make require an access token. This is a very convenient way to quickly grab the current access token.
95
89
96
-
!!!note "The API Key environment variable is ignored by the CLI but used by the Python library"
97
-
If you do create a `PL_API_KEY` environment variable, the CLI will be unaffected but the Planet library will use this as the source for authorization instead of the value stored in `planet auth init`.
90
+
**Note** : As a security measure, access tokens are time limited. They have a relatively short lifespan, and must
91
+
be refreshed. The `print-access-token` command takes care of this transparently for the user.
Copy file name to clipboardExpand all lines: docs/get-started/quick-start-guide.md
+5-3
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,12 @@ pip install planet
27
27
28
28
### Authentication
29
29
30
-
Use the `PL_API_KEY` environment variable to authenticate with the Planet API. For other authentication options, see the [SDK guide](../python/sdk-guide.md).
30
+
Use the `planet auth` CLI command to establish a user login session that will
31
+
be saved to the user's home directory. For other authentication options, see
32
+
the [Client Authentication Guide](../python/sdk-client-auth.md).
31
33
32
34
```bash
33
-
export PL_API_KEY=your_api_key
35
+
planet auth login
34
36
```
35
37
36
38
### The Planet client
@@ -39,7 +41,7 @@ The `Planet` class is the main entry point for the Planet SDK. It provides acces
The Planet client has members `data`, `orders`, and `subscriptions`, which allow you to interact with the Data API, Orders API, and Subscriptions API. Usage examples for searching, ordering and creating subscriptions can be found in the [SDK guide](../python/sdk-guide.md).
0 commit comments