This project shows you how to make a simple 3-legged OAuth2 user flow (BETA).
Install all packages of project, configure .env with required properties, then start TypeScript compiler.
npm i
cp .example.env .env
# ...configure .env with consumer keys
# then start the server
npm run start
.example.env
to .env
file.env
filehttp://localhost:5000/callback
is present in allowed callback URLs, inside your Twitter application settings (in developer portal).Navigate to http://localhost:5000
to test callback-based flow.
1) It generate a authentification link (routes/callback.ts
, router.get('/')
) that renders into views/index.ejs
.
2) User clicks link, and is redirected to routes/callback.ts
, router.get('/callback')
route.
3) Route use stored tokens into session to generate definitive access token, then renders views/callback.ejs
with access token data.