Create personal access token request for organization

5.2k views Asked by At

I've set up the access token strategy for a GitHub organization so that access token require admin approval. As the picture below says: "All access requests by organization members to this organization must be approved before the token is usable."

However I do not find anywhere where such a request can be made.

We have a bot account that's supposed to post issues on one of the organization's private repositories. When creating a personal access token (fine grained) for the bot account, no such request is being made (and no access is given) and there is no option to pick a repository from the organization or something along those lines.

So how do you send a request for access token permission to an organization?

GitHub UI

2

There are 2 answers

2
vorburger On

The process for Personal Access Tokens (PAT) permission to a GitHub organization is like this:

  1. Enabled PATs on the Organization's (not your personal!) Settings, at .../settings/personal-access-tokens-onboarding (or modify them on ../settings/personal-access-tokens)

  2. Go to Account settings > Developer settings > Fine-grained tokens. For an Org, you must use YOUR (or the Bots', not the Orgs!) Setttings, and change the Resource owner from you to the Org on this screen.

  3. The Orgs's .../settings/personal-access-token-requests should now show the request to approve.

  4. If you create a PAT for an Org Owner, it's directly granted, and shows up on the Org's .../settings/personal-access-tokens/active

3
VonC On

So how do you send a request for access token permission to an organization ?

It seems to be done automatically, according to the documentation:

When organization members create a fine-grained personal access token to access resources owned by the organization, if the organization requires approval for fine-grained personal access tokens, then an organization owner must approve the token before it can be used to access any resources that are not public.
For more information, see "Setting a personal access token policy for your organization."

GitHub will notify organization owners with a daily email about all fine-grained personal access tokens that are awaiting approval.

When a token is denied or approved, the user who created the token will receive an email notification.

Check first if an email is received (assuming the email associated to your bot is accessible).