GitHub Personal Access Tokens (PATs) provide a secure way for developers to authenticate with GitHub's platform, whether through the command line or the GitHub API. For cases like the JustDataPlease Reports for GSheets, creating a PAT is essential for secure API access. This guide explains how to create and use a PAT tailored for this addon.
What is a Personal Access Token on GitHub?
A Personal Access Token (PAT) serves as an authentication method in place of passwords when performing Git operations over HTTPS or interacting with the GitHub API. PATs offer enhanced security, particularly with two-factor authentication (2FA), allowing for restricted access with specific scopes, and can be easily revoked if necessary.
Steps to Generate a Personal Access Token
Step 1: Log Into GitHub
- Visit GitHub.com and sign in with your credentials.
Step 2: Access Developer Settings
- In the upper-right corner, click on your profile icon.
- From the drop-down menu, choose Settings.
Step 3: Navigate to Personal Access Tokens
- On the left sidebar, scroll down and click Developer settings.
- Under Developer settings, select Personal access tokens.
- Depending on your use case, choose either Tokens (classic) or Fine-grained tokens.
Step 4: Click "Generate New Token"
- For a classic token, you’ll find a Generate new token button at the top right.
- If you're using a fine-grained token (which offers more specific permissions), click Generate new token (fine-grained).
Step 5: Configure the Token Settings
- Token Description: Name your token appropriately. For this case, use JustDataPlease Reports for GSheets to easily identify it.
- Expiration Date: Choose how long the token should remain valid. For this addon, select "90 days" to ensure periodic renewal.
- Select Scopes: You do not need to select any scopes for this use case.
Step 6: Generate the Token
- After configuring the expiration and other settings, click Generate token.
Step 7: Save Your Token
- GitHub will display the token value after generation. Copy and store the token securely, as GitHub will not display it again once you leave the page.
- If the token is lost, you'll need to revoke it and generate a new one.