This is a TypeScript example with Passport and @superfaceai/passport-twitter-oauth2
packages on Express server. The logic is the same as in basic-usage example: After a successful login, the application shows user profile information and logs the access token to a console.
Additional type dependecies for Node.js, Express, Passport, and passport-session are added for correct type checking.
Check @superfaceai/passport-twitter-oauth2
for more info about the package and step-by-step tutorial on setting up the Twitter application.
- Install dependencies
npm i
- Copy
.env.example
to.env
cp .env.example .env
- Paste your Client ID and Client Secret from Twitter developer portal to
.env
file
- Build the TypeScript files
npm run build
- Start the server
npm start
- Visit
http://localhost:3000/auth/twitter
If you run into any issues with the example, please don't hesitate to open an issue.