Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 2.09 KB

create-update-auth.md

File metadata and controls

42 lines (26 loc) · 2.09 KB

Create/update a GitHub access token

The scripts in this repo require the use of a github token to authenticate. Use these steps to create the token. When the token expires, redo the same steps to create a new token.

Create a GitHub token

  1. Go to https://github.com/settings/tokens. Generate a new token (classic). Add a note and pick an expiration date. Skip all the checkboxes; scroll to the bottom, and click Generate token.
  2. COPY the token. SAVE it somewhere temporarily. It's about to go away and you'll need it in a future step.
  3. Use Configure SSO to authorize MicrosoftDocs to use the token. Once you start this step, you'll never see the text of the token again. So make sure you've copied it before you select the dropdown.

Save the token as a Codespace secret

To save/update a Codespace secret:

  1. Go to https://github.com/settings/codespaces.
  2. Add or update the secret.
    • If adding for the first time
      1. Click New secret.
      2. The secret name is GH_ACCESS_TOKEN The value is the token you copied above.
      3. Dropdown Select repositories and add the repo sdgilley/learn-tools.
    • To update GH_ACCESS_TOKEN, click Update.
      • Under Value you'll see a sentence saying it can't be displayed. Click on the enter a new value link, then paste in your new token.
    • Select Save changes.

Update your codespace

Once you've created or changed the secret or environment variable, you'll need to restart any open Codespaces to use the new token.

If you have a codespace open, it sometimes detects the change and asks you if you want to restart. If it doesn't, you can restart it manually. At the bottom left, click on the Codespaces name, then select Rebuild Container.

For local environments

To run the scripts locally, save the token as an environment variable with the name GH_ACCESS_TOKEN.

Close and reopen VS Code to use the new token.

Besides authentication, you also need to pip install PyGithub to use the scripts locally.

Next

Return to Maintain code snippets in Azure docs.