Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Latest commit

 

History

History
15 lines (10 loc) · 1.32 KB

README.md

File metadata and controls

15 lines (10 loc) · 1.32 KB

Twitter NextJS Backend

An easy example of Twitter backend using Twitter API v2 and OAuth2 authorization using NextJS.

This example can be easily deployed on Vercel; however, it will be necessary to prepare the APIs and also register as developer with Twitter account. So far, there are only a few examples to fetch tweets by query and ids, and fetch user info by username.

The current APIs get query from request body, but you can also move the API use dynamic route.

/pages/api/ - API example
/src/oauth/index.js - OAuth2 authorization script that you need to use in API to get access key!

This source code is what helped me get rid of 401 error. Most resources I found online were complaining about the Twitter APIv2 servers issues etc. (which is possible ofc) I think my code before was just bad and this works, so it was bad. See threads here: 1 2

Check Twitter API endpoint status here.