Coder Social home page Coder Social logo

express-ethereum-twitter-auth's Introduction

express-twitter-ethereum-auth

Usage

In your express app's initialization, do the following:

const express = require('express')
const session = require('express-session')
const eeta = require('express-ethereum-twitter-auth')

const app = express()

// You need to use express-session for the default auth to persist
// If you're using your own auth, you can skip this
var sess = {
  secret: 'THIS_SHOULD_BE_A_SECRET',
  cookie: {},
}
app.use(session(sess))

// Get these keys by going to https://developer.twitter.com/en/apps
// Create an app, make sure to check `Enable Sign in with Twitter`
// and add a callback url of `http://localhost:3000/_auth/eeta/twitter/callback`
const consumerKey = process.env.TWITTER_CLIENT_KEY
const consumerSecret = process.env.TWITTER_CLIENT_SECRET

// Setup twitter OAuath. You can skip this if you have your own method of auth.
// The only requirement is that req.user.id exists if an only if the user is logged in
eeta.setupAuth(app, consumerKey, consumerSecret)

const JWT_SECRET = 'THIS_SHOULD_BE_A_SECRET'
// Setup the routes
app.use(eeta.routes(JWT_SECRET))

// Define your own routes
app.get(...)

Simple example

yarn install

# Get these from https://developer.twitter.com/en/apps
export TWITTER_CLIENT_KEY=...
export TWITTER_CLIENT_SECRET=...

node examples/simple/main.js
# go to http://localhost:3000 in your browser

Full Example

This also requires an AWS account. Assuming you've already setup an AWS user with access to S3, you should run the example like so:

export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...

export TWITTER_CLIENT_KEY=...
export TWITTER_CLIENT_SECRET=...

node examples/kitchen-sink/main.js
# go to http://localhost:3000 in your browser

express-ethereum-twitter-auth's People

Contributors

jparyani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.