DEV Community

Cover image for GitHub Personal Access Tokens (PAT)
Mfon.
Mfon.

Posted on

GitHub Personal Access Tokens (PAT)

"Support for password authentication was removed. Please use a personal access token".

During my earliest stage in the tech space as a budding developer, I had hitches with GitHub. I mean, every developer experiences this. I tried to run git operations. I got the error message that indicated that password authentication was removed and I would need to use a personal access token. Thanks to instructions provided by my technical mentor, I was able to navigate through this challenge.
This article seeks to guide you through this process if you are at this phase in your programming journey.

What is GitHub Personal Access Token?

Personal Access Token is a long string of characters used to authenticate a user when accessing the GitHub server instead of password-based authentication. In other words, if you want to run git operations, you will be required to generate a Personal Access Token rather than use a password you create for yourself.

Features of GitHub Personal Access Token

  1. It is unique
  2. It is a long string of character combinations
  3. It is more secure than passwords
  4. It is hard to read
  5. You have to generate it
  6. You can decide if it expires or not (It is not advisable to create PAT with no expiry date)
  7. It is revocable
  8. It allows you to control access to certain features

How To Create A GitHub Personal Access Token

Step 1: Click your profile on GitHub:

snapshot of GitHub Profile icon

Step 2: Go to settings:

snapshot of GitHub settings option

Step 3: Scroll down and click "Developer settings" at the bottom left:

snapshot of GitHub Developer settings option

Step 4: Click "Personal access tokens":

snapshot of GitHub personal access tokens option

Step 5: Click "Generate new token":

snapshot of GitHub generate new token icon

Step 6: Type in your password and confirm access:

snapshot of GitHub confirm access page

Step 7: Insert a note:
This could be the project name.

snapshot of GitHub insert a note page

Step 8: Select the number of days before it expires:

snapshot of GitHub select expiry date option

Step 9: Select scopes to grant and limit access to certain features:

snapshot of GitHub select scopes page

Step 10: Click "Generate token":

snapshot of GitHub generate token icon

Step 11: Copy the token:
Make sure you copy the token and keep it safe so you can use it. If you don't, you will have to generate a new one to perform git operations.

References

Cover Image Credit

Top comments (1)

Collapse
 
manavss profile image
Manav Shete

Hi i am using a personal token in one of my projects to access GitHub api.But when i publish the project to the GitHub public repo the token gets revoked.How do i solve this?