nelsontky / gh-pages-url-shortener

Minimal URL shortener that can be entirely hosted on GitHub pages.
https://ccb.wtf/1
GNU General Public License v3.0
1.34k stars 506 forks source link

Github Issues API is not available on private repo except you generate the access token. #61

Closed hongvin closed 3 years ago

hongvin commented 3 years ago

Just a suggestion to add in the Readme to highlight if they want the repo to be private.

Generate Personal Access Token with full repo control at Settings/Developer Settings/Personal Access Token.

Add the generated token to 404.html page at line 70, where xhr.open("GET", GITHUB_ISSUES_LINK + issueNumber + "?access_token=<YOUR_TOKEN_HERE>");

EDIT: Quick Note: this method will no longer work starting May 5, 2021 at 16:00 UTC. Instead use the authorization header stated below.

Once again, thank you for this awesome repo!

nelsontky commented 3 years ago

Hmm that's a great suggestion! Quick question since I'm not very familiar with the GitHub API. Is there a way to limit the functionalities of a generated token to ensure security of this method?

hongvin commented 3 years ago

You can limit the token's scope, as stated here.

Sadly, this direct call method support will be ended by next year as stated here. Instead, add the header to XML call, with xhr.setRequestHeader("Authorization","token <YOUR TOKEN>"), ~but I can't seem to get it working.~ it's working now. Because I forget to add https in front of the website.

nelsontky commented 3 years ago

Great! I will add it into the README when I have the time! If you do have a fork, feel free to let me know too and I can feature your fork on the README too! Thank you!

hongvin commented 3 years ago

Hi @nelsontky I didn't do any fork. Just a suggestion here 👍