How to access raw content from a private org repo (behind SSO) using OAuth access token #24744
-
Hi, I am trying to fetch the content of a file using a ‘raw’ URL (https://raw.githubusercontent.com). That file is from a private repository in an Organization using SSO. I can fetch the file using a Personal Access Token (PAT), but not using an OAuth access token. Here is what I did:
I can hit
So this tells me that my PAT and OAuth tokens are valid. When I try to fetch a file from a private repository, only the call using the PAT works:
What’s missing to make this work using my OAuth access token? Is it something even possible? Note: To give more context on what I am trying to do, I have an application using Keycloak as an Identity Broker and GitHub is a configured Identity Provider. The OAuth application that I registered at the start of this post is for Keycloak. A user can authenticate to my application using GitHub as the identity provider. Once authenticated, Keycloak stores the token returned by GitHub and the user can retrieve it on demand to access files in GitHub. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The solution to my problem was a missing scope when requesting an OAuth token. I needed to add |
Beta Was this translation helpful? Give feedback.
The solution to my problem was a missing scope when requesting an OAuth token. I needed to add
repo
as scope. By default, it was onlyuser:email
.