Prefilling OAuth2 scopes for GitHub Personal Access Tokens

Featured image for sharing metadata for article

A while ago, I was setting up a fair few GitHub Personal Access Tokens, and was finding it a little frustrating to need to keep hand-selecting the scopes required. I can't actually remember how I found out about it, but it turns out that by tweaking the URL, you can pre-fill the scopes that are selected.

I'd shared this knowledge with a project that would benefit from this, but I've not publicly blogged about this for other folks who may not know this.

Let's say you want to create a new token that has access to public_repo and repo, we can construct the URL:

https://github.com/settings/tokens/new?scopes=public_repo,repo

Going to the URL above gives you a handy pre-filled form, but still allows you to review it, add your own note for what the token is, and set expiry.

Right now, this only works for Personal Access Tokens (Classic).

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #github #oauth2.

Also on:

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.