0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GithubのPersonal Access Tokenがどのユーザーのやつかわかんなくなったとき

Posted at

This token is 誰

個人のトークンとかチーム共有のトークンとかアプリケーション固有のトークンとかあるじゃないですか。
でもアクセストークンさん一度発行したら最後、二度とGithub上で表示されないじゃないですか。
たくさんのトークンが混ざるともうだめ。誰ですかおまえは。

トークンを使って"自分"のユーザー情報を取得する

こうじゃ。

Request

$TOKENのとこに正体を知りたいトークンをいれる。

curl \
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: token $TOKEN" \
  https://api.github.com/user

Response

loginというフィールドで名乗ってくださる。
メールアドレスとかも教えてくださる。完璧である。

{
  "login": "my-user-name",
  "id": 123456789,
 ~~以下略~~
}

めでたし!!!!!!!

知らなかったの私だけかもしれないですけどね…!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?