Hey i want know if github have a endpoint to verify if a access_token have expired ? I have tried this but i have a 404 error
Asked
Active
Viewed 129 times
1 Answers
0
404 would mean you did not authenticate properly.
Make sure to use a PAT (Personal Access Token) to authenticate your query (assuming you are not testing you own PAT itself!)
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \ <==== Important
https://api.github.com/applications/Iv1.8a61f9b3a7aba766/token \
-d '{"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a"}'

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
Can i can generate a PAT using the API ? – PastaLaPate Oct 06 '22 at 18:07
-
@PastaLaPate I don't think so. The [usual procedure is manual](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). – VonC Oct 06 '22 at 19:32
-
therefore i dont can create a php function to verify if the token is valid ? – PastaLaPate Oct 07 '22 at 05:31
-
@PastaLaPate Verification implies the token is already created first, and you want to check its validity. So yes, you can create a PHP function (doing a [php curl](https://github.com/ares333/php-curl)), to check an *existing* token. – VonC Oct 07 '22 at 05:36