Getting 403 forbidden when trying to call the Github API [Answered]
I'm trying to call https://api.github.com/repos/thinker227/FolderTool/releases/latest to get the latest release from a repo, and accessing the API URL from the browser works perfectly fine, but when making the request from code using
HttpClient.GetAsync()
causes it to return 403 forbidden as a response. This just seems kind of odd, although maybe I'm just missing something.4 Replies
Am I like missing something with headers?
You might need to create a access token to pass
In the docs they use some custom Accept header, unsure if it's important here
https://docs.github.com/en/rest/quickstart
ugh
wait hold on
yeah
I mean obviously the docs mention authentication, although it's completely possible to access the API without any authentication from the browser
https://docs.github.com/en/rest/releases/releases#get-the-latest-release
ah
yeah now it works
User-Agent: "b"
yeah uh this works
✅ This post has been marked as answered!