basyura's blog

あしたになったらほんきだす。

GitHub API - Deprection notice for authetication via URL query parameters

あまりツイートすることも無くなってきたので記録がてら GitHub にコミットがあったら垂れ流すようにするスクリプトを動かしているのだけど、非推奨になってる API を使っているから直せとメールが来ていた。ずっと無視していたけど年末年始の休みという自由時間ができたので直した。

https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/

As mentioned in this previous blog post, GitHub no longer supports authentication through query parameters. Instead, we recommend users move the authentication in the header.

クエリパラメータで指定していたのをヘッダで指定するように変えるだけ。

# before
curl "https://api.github.com/user/repos?access_token=my_access_token"

# after
curl -H 'Authorization: token my_access_token' https://api.github.com/user/repos

スクリプト修正中に、指定するパスにある user を消していたために謎の not found で 1 時間ぐらい悩んだけど直せた。めでたしめでたし。