zlin / wgetpaste

MIT License
34 stars 18 forks source link

Github Gists not working with current example "token" ; workaround/fix included #33

Closed genbtc closed 2 years ago

genbtc commented 2 years ago

After following Creating a personal access token to create my Github token with a Gists permission, and then following the (meager) instructions at the end of "wgetpaste --help",

the Token does not work as described "HEADER_gists="Authorization: token ***".

However this does work: my example wgetpaste.conf token file fix

I spent a (large) amount of time trying to get "Authorization: token" to work, and I was unable to. Only various forms of "Authentication: Basic" work now, with modifications:

Option 1) echo -n ${GITHUB_TOKEN}:x-oauth-basic | base64 Option 2) echo -n ${DEFAULT_NICK}:${GITHUB_TOKEN} | base64

This b64 encodes the token along with a mandatory 2nd field to be sent as the header, albeit in "Basic" mode, not "Token" mode. I prefer option 1, where the nickname username is optional.

If you compare most examples on the web, most are using CURL and this is a more typical way of how the headers get sent, I was unable to find any evidence of "Authorization: token" even working at all. Perhaps its outdated, or the API Changed? Im not sure.

I also want to mention, to please create your own personal token for testing Gists, so you don't have to "HARD_SKIP" the Auth Test @ https://github.com/zlin/wgetpaste/blob/master/test/test.sh#L18 . You can store it in an env variable, so you dont have to publish the token, and the test script will remain functional for other users, but you will have the ability to sanity check the Auth Test on your computer at least every 6 months.

Extra Notes: Using base64 in the .conf file is allowed, since its bash, and as per your documentation, coreutils is required, and base64 comes from coreutils. Theoretically this could be embedded in the script but adequate documentation would also suffice. I am mostly looking for confirmation on the issue, and also to document my findings here in the meantime.

Thanks!, Gentoo greatly appreciates your script, it's of essential importance.

heirecka commented 2 years ago

I'm not sure what you're trying achieve with and why you're going on about base64, but the example from wgetpaste --help works perfectly fine for me.

Sure, the testing situation could be improved (they don't exist for that long yet), although there are concerns about using the services for such purposes.

genbtc commented 2 years ago

For some reason everyone elses works but me, I dont know what to say, besides Sorry.