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

NextJS API backend for Twitter API v2 using OAuth2 authorization.

Notifications You must be signed in to change notification settings

asitanc/twitter-next-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

NextJS API backend for Twitter API v2 using OAuth2 authorization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published