This is a simple web site to generate access token with PKCE for Twitter App. This site is intended to run in a local environment.
-
Execute following command to run the site.
docker-compose up -
Access to
http://127.0.0.1:8888/auth/, and follow the instructions in that page.Access to Twitter Developers Portal and create a new Twitter app. Then, please input following url to OAuth redirect URL form.
http://127.0.0.1:8888/auth/step2-3/Please create
appconfig.jsonfile with following format, and put it to/authdirectory.cp auth/appconfig.json.sample auth/appconfig.jsonand edit it.
Access the link displayed on the page to request authorization.
When you authenticate on the Twitter app authentication screen, you will be redirected to
http://127.0.0.1:8888/auth/step2-3/and the authentication results will be displayed.Execute the curl command shown on the screen to obtain an access token. The result will be output to the
token.jsonfile. -
(option) Refresh access token.
If you have
refresh_token, the following command can be executed to refresh the access token.curl -u ${CLIENT_ID}:${CLIENT_SECRET} \ -X POST 'https://api.twitter.com/2/oauth2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode "refresh_token=${REF_TOKEN}" \ --data-urlencode 'grant_type=refresh_token' \ --data-urlencode "client_id=${CLIENT_ID}" \ | jq