Search code examples
githuboauth-2.0oauthgithub-token

How to SSO Authorize Github API generated personal access token


I'm trying to create GitHub personal access tokens programmatically using the endpoint https://github.com/login/oauth/access_token and a GitHub App, following the device flow and code exchange.

The creation seems to be working fine and gets a response with the token However, our account has SSO integration, and this requires all tokens to be authorized by the SSO in order to work, so the token receives a 404 response for any call to our private repositories, which I believe is related to the lack of SSO authorizing it

I can't find any documentation specifying how to authorize tokens generated via the API

IMPORTANT: I know how to authorize tokens generated via the Github Web UI, I'm talking about tokens generated via the API endpoint https://github.com/login/oauth/access_token device-flow, with code exchange! Those tokens are not available at the UI and I cannot find how to authorize them

Any idea on how to solve it?


Solution

  • This doesn't seem to be documented anywhere, but you need to use user oauth2

    GitHub clone repo with fine-grained personal access tokens (PAT)