Skip to content

Updated the personal access token page and information #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions docs/api/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ import UpcomingFeature from '@site/src/components/UpcomingFeature';

## Personal access tokens

The ETM API uses personal access tokens (also called "API keys") to authenticate requests. You can add and remove these keys [**from your settings page**](https://engine.energytransitionmodel.com/identity/tokens).
:::info Token Expiry Update
Previously, tokens could be created without an expiration date. This feature has been deprecated, and tokens can now have a maximum lifespan of one year.
:::

These keys provide access to your account and scenarios, so be sure only to share them with trusted applications. It's highly recommended that you create a new token for each application, rather than reusing the same token in many places. There is no limit to how many you can create.
The ETM API uses personal access tokens (also called "API keys") to authenticate requests. You can add and remove these keys [**from your settings page**](https://my.energytransitionmodel.com/identity/tokens).

These keys provide access to your account and scenarios, so be sure only to share them with trusted applications. It's highly recommended that you create a new token for each application, rather than reusing the same token in many places. There is no limit to how many you can create.

Authentication with the API is with a bearer token. See: [Using your access token](#using-your-access-token).

### Creating an access token

Access tokens may be created on [**your ETM settings page**](https://engine.energytransitionmodel.com/identity/tokens). After you create your token, the full token string will only be shown for a short period. Be sure to copy it somewhere secure as it will not be shown again.
Access tokens may be created on [**your ETM settings page**](https://my.energytransitionmodel.com/identity/tokens). After you create your token, the full token string will only be shown for a short period. Be sure to copy it somewhere secure as it will not be shown again.

:::info I've lost my token!
If you lose your token, head to your [access tokens](https://engine.energytransitionmodel.com/identity/tokens) page, revoke the token so that it can no longer be used to access your account, and then create a new token.
If you lose your token, head to your [access tokens](https://my.energytransitionmodel.com/identity/tokens) page, revoke the token so that it can no longer be used to access your account, and then create a new token.
:::

### Using your access token
Expand All @@ -38,12 +41,12 @@ curl https://engine.energytransitionmodel.com/api/v3/scenarios \
GET /api/v3/scenarios HTTP/2
Host: engine.energytransitionmodel.com
Accept: application/json
Authorization: Bearer etm_xcNxTaX8KLr5LkGs93sRWnGfhyAUDPWPqKVGe1RL73GJUnfQ
Authorization: Bearer etm_xcNxTaX8KLr5LkGs93sRWnGfhyAUDPWPqKVGe1RL73GJUnfQ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this addition about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to take it out, I thought it might be misleading to suggest the tokens are only this big, but I also didn't want to put a full token in the example because it isn't the most readable

```

## Using the API without authentication

Without authentication, your use of the API results in scenarios that are considered "unowned" and can be both viewed *and changed* by anyone. [Creating an ETM account](https://engine.energytransitionmodel.com/identity/sign_up) will allow you create scenarios that belong to you, where you can strictly control who can view your data, and prevent others from making changes.
Without authentication, your use of the API results in scenarios that are considered "unowned" and can be both viewed *and changed* by anyone. [Creating an ETM account](https://my.energytransitionmodel.com/identity/sign_up) will allow you create scenarios that belong to you, where you can strictly control who can view your data, and prevent others from making changes.


## Get information about a token
Expand Down