Conveniently link users to a pre-filled New GitHub Personal Access Token Page
Dak Washbrook
Posted on November 15, 2020
My use case was allowing users to update a CLI tool directly from a private repo's releases that they would already have access to. The CLI tool required a valid GitHub access token with specific permissions.
To make this easy for the users, I wanted the CLI tool to open up directly into a pre-filled permissions page, instead of having to fill it in based on a README.md
entry.
I dug around the page for the id
of the input
fields to see if I could use those to pre-fill. After trying a few variations I found it!
The base URL is
https://github.com/settings/tokens/new
Appending the following query parameters onto the URL allows us to pre-fill the form.
For Example:
https://github.com/settings/tokens/new?description=my-cli-tool&scopes=repo,read:packages,read:org
description
fills the "Note" field.
scopes
allows for a comma-separated list of the scopes.
Now your user only needs to press "Generate token" at the bottom of the page.
Posted on November 15, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024