Skip to content

Commit 1f2d8aa

Browse files
author
Steve Winton
authored
[July 26 2021] Document PAT expiration (github#19469)
1 parent 99ac68f commit 1f2d8aa

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed
67.6 KB
Loading

assets/images/personal_token.png

317 KB
Loading

content/developers/apps/getting-started-with-apps/about-apps.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Keep these ideas in mind when using personal access tokens:
8484
* You can run personal scripts.
8585
* Don't set up a script for your whole team or company to use.
8686
* Don't set up a shared user account to act as a bot user.
87+
* Do set an expiration for your personal access tokens, to help keep your information secure.
8788

8889
## Determining which integration to build
8990

content/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ topics:
1616
- Access management
1717
shortTitle: Create a PAT
1818
---
19-
Personal access tokens (PATs) are an alternative to using passwords for authentication to {% data variables.product.product_name %} when using the [GitHub API](/rest/overview/other-authentication-methods#via-oauth-and-personal-access-tokens) or the [command line](#using-a-token-on-the-command-line).
19+
Personal access tokens (PATs) are an alternative to using passwords for authentication to {% data variables.product.product_name %} when using the [GitHub API](/rest/overview/other-authentication-methods#via-oauth-and-personal-access-tokens) or the [command line](#using-a-token-on-the-command-line).
2020

2121
{% ifversion fpt %}If you want to use a PAT to access resources owned by an organization that uses SAML SSO, you must authorize the PAT. For more information, see "[About authentication with SAML single sign-on](/github/authenticating-to-github/about-authentication-with-saml-single-sign-on)" and "[Authorizing a personal access token for use with SAML single sign-on](/github/authenticating-to-github/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)."{% endif %}
2222

@@ -31,16 +31,17 @@ Personal access tokens (PATs) are an alternative to using passwords for authenti
3131
4. Click **Generate new token**.
3232
![Generate new token button](/assets/images/help/settings/generate_new_token.png)
3333
5. Give your token a descriptive name.
34-
![Token description field](/assets/images/help/settings/token_description.png)
35-
6. Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select **repo**.
34+
![Token description field](/assets/images/help/settings/token_description.png){% ifversion fpt or ghes > 3.1 or ghae-issue-4374 %}
35+
6. To give your token an expiration, select the **Expiration** drop-down menu, then click a default or use the calendar picker.
36+
![Token expiration field](/assets/images/help/settings/token_expiration.png){% endif %}
37+
7. Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select **repo**.
3638
{% ifversion fpt or ghes %}
3739
![Selecting token scopes](/assets/images/help/settings/token_scopes.gif)
3840
{% elsif ghae %}
3941
![Selecting token scopes](/assets/images/enterprise/github-ae/settings/access-token-scopes-for-ghae.png)
4042
{% endif %}
41-
7. Click **Generate token**.
43+
8. Click **Generate token**.
4244
![Generate token button](/assets/images/help/settings/generate_token.png)
43-
8. Click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the token to your clipboard. For security reasons, after you navigate off the page, you will not be able to see the token again.
4445
{% ifversion fpt %}
4546
![Newly created token](/assets/images/help/settings/personal_access_tokens.png)
4647
{% elsif ghes > 3.1 or ghae-next %}
@@ -50,7 +51,7 @@ Personal access tokens (PATs) are an alternative to using passwords for authenti
5051
{% endif %}
5152
{% warning %}
5253

53-
**Warning:** Treat your tokens like passwords and keep them secret. When working with the API, use tokens as environment variables instead of hardcoding them into your programs.
54+
**Warning:** Treat your tokens like passwords and keep them secret. When working with the API, use tokens as environment variables instead of hardcoding them into your programs.
5455

5556
{% endwarning %}
5657

content/rest/guides/getting-started-with-the-rest-api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ When authenticating, you should see your rate limit bumped to 5,000 requests an
147147
148148
You can easily [create a **personal access token**][personal token] using your [Personal access tokens settings page][tokens settings]:
149149
150+
{% ifversion fpt or ghes > 3.1 or ghae-issue-4374 %}
151+
{% warning %}
152+
153+
To help keep your information secure, we highly recommend setting an expiration for your personal access tokens.
154+
155+
{% endwarning %}
156+
{% endif %}
157+
150158
{% ifversion fpt or ghes %}
151159
![Personal Token selection](/assets/images/personal_token.png)
152160
{% endif %}
@@ -155,6 +163,10 @@ You can easily [create a **personal access token**][personal token] using your [
155163
![Personal Token selection](/assets/images/help/personal_token_ghae.png)
156164
{% endif %}
157165
166+
{% ifversion fpt or ghes > 3.1 or ghae-issue-4374 %}
167+
API requests using an expiring personal access token will return that token's expiration date via the `GitHub-Authentication-Token-Expiration` header. You can use the header in your scripts to provide a warning message when the token is close to its expiration date.
168+
{% endif %}
169+
158170
### Get your own user profile
159171
160172
When properly authenticated, you can take advantage of the permissions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
As a security precaution, {% data variables.product.prodname_dotcom %} automatically removes personal access tokens that haven't been used in a year.
1+
As a security precaution, {% data variables.product.company_short %} automatically removes personal access tokens that haven't been used in a year.{% ifversion fpt or ghes > 3.1 or ghae-issue-4374 %} To provide additional security, we highly recommend adding an expiration to your personal access tokens.{% endif %}

0 commit comments

Comments
 (0)