Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

NodeJS actually using OAuth (Twitter)

NodeJS actually using OAuth (Twitter)


I am using node (8.14.0) and want to access the Twitter REST API v1.1. I tried node-Oauth so far and simple https, but none of them worked further then "login with twitter". I don't just want to authenticate user's (aka sign in with twitter), I want to perform actions on the API with their access. My problem is, I have not found a single example for node describing the actual process of retrieving the needed access/request tokens from the user and performing the API call with them.

All node-oauth examples "assume that you already have access token and access whatever". Well I do not have them, and I do not know how to get them, since I find no concrete example or documentation. Only a reference to a reference.

Problem courtesy of: Julius F


As I know the oauth libraries are to authenticate or authorize.
While the authentication you get back the accestoken and refreshtoken from the platform.
This tokens you have to save in your session or database.
After that you can use it in combination with other libraries.

I suggest to have a look at passport or everyauth for user authentication. They both support oauth.

in addition:
Google has a pretty good documentation about OAuth in general. I think this schema can be applied to other platforms too.

Solution courtesy of: Marc Bachmann


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

NodeJS actually using OAuth (Twitter)


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription