GitHub Api - Unable to access organisation repository and its branches

When i try to hit it using the url i am get the response - 

resp = requests.get("https://api.github.com/repos/FileTrek/TestRepo/git/refs?access\_token=888888888888888888")

But when i try to do using the below snippet, i am not getting Not Found error.

url ="https://api.github.com/repos/FileTrek/TestRepo/git/refs"  
print(url)
data = {"access\_token":"888888888888888888"}
payload = json.dumps(data)

logging.info("Data Payload : " + payload)

response = requests.post(url, data=payload)
print(response.json())

Should i pass the access_token as data payload or in header as Authorization parameter.

Hi @arun0910,

Just FYI, your access tokens weren’t obfuscated in the same way, so I took the liberty of obfuscating your first access token in the same way as the the other just in case that was your actual token. If that was your actual token, you may want to deactivate it and create a new one in case someone was able to capture it.

To answer your question, you should be passing authorization tokens in as a header for API calls.

Thanks!

1 Like