User Commands#

The es user command has a variety of helpful sub-commands for interacting with your EarthScope account and access management.

es user

 Usage: es user [OPTIONS] COMMAND [ARGS]...

 Use Earthscope API user endpoints

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ get-access-token        Get the access token.                                                                              │
│ get-access-token-body   Get the access token's body.                                                                       │
│ get-aws-credentials     Get temporary AWS credentials to directly access EarthScope's AWS resources (e.g. S3 buckets).     │
│ get-profile             Get the user profile associated with these credentials.                                            │
│ get-refresh-token       Get the refresh token.                                                                             │
│ refresh-access-token    Refresh the access token immediately.                                                              │
│ revoke-refresh-token    Revoke the refresh token immediately.                                                              │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Fetch your EarthScope user profile.#

You can ensure your CLI is working correctly by fetching your EarthScope user profile with es user get-profile. This command calls the EarthScope API’s get-user-profile endpoint.

es user get-profile
{
  "first_name": "Jane",
  "last_name": "Doe",
  "country_code": "US",
  "region_code": "CO",
  "institution": "EarthScope Consortium",
  "work_sector": "Non-Profit",
  "user_id": "google-oauth2|111222333444555666777",
  "primary_email": "jane.doe@earthscope.org",
  "created_at": "2022-09-16T17:59:55.819851Z",
  "updated_at": "2024-11-26T20:06:08.979656Z"
}

Get Access Token#

Use es user get-access-token to retrieve your access token for manual use outside of the EarthScope CLI/SDK.

es user get-access-token
eyJhbG...YOUR_ACCESS_TOKEN...KmdfpmA

This access token can be passed in the standard HTTP Authorization header. E.g. with curl

curl "https://api.earthscope.org/beta/user/profile" \
  -H "Authorization: Bearer eyJhbG...YOUR_ACCESS_TOKEN...KmdfpmA"

Get Refresh Token#

Use es user get-refresh-token to retrieve your refresh token.

es user get-refresh-token
zMe7z...YOUR_REFRESH_TOKEN...9Ta0L

This token can provide refreshable credentials to remote hosts leveraging the EarthScope SDK. See EarthScope SDK docs for details on this usage pattern.

Warning

Your refresh token is a sensitive credential. Anyone with access to it can use it to continually retrieve new access tokens on your behalf. Treat it like a password and never commit it to version control.

Use es user revoke-refresh-token to revoke your refresh token if you suspect it has been compromised.