Socket
Book a DemoInstallSign in
Socket

twitter-pin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-pin

A dead simple Twitter PIN-based authorization module

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

twitter-pin

A dead simple Twitter PIN-based authorization module.

The PIN-based OAuth flow is intended for applications which cannot access or embed a web browser in order to redirect the user to the authorization endpoint. Examples of such applications would be command-line applications, embedded systems, game consoles, and certain types of mobile apps.

Twitter / Developers / Documentation / OAuth / PIN-based authorization

Build status js-standard-style

Installation

npm install twitter-pin

Usage

The twitter-pin module should be initialzied with the consumerKey and consumerSecret issued by Twitter when you register your Twitter application. After registering click "manage keys and access tokens" under the apps "Application Settings".

var twitterPin = require('twitter-pin')(consumerKey, consumerSecret)

twitterPin.getUrl(function (err, url) {
  if (err) throw err

  console.log('1) Open:', url)
  console.log('2) Enter PIN:')

  process.stdin.once('data', function (pin) {
    twitterPin.authorize(pin.toString().trim(), function (err, result) {
      if (err) throw err

      console.log(result) // => { token: '...',
                          //      secret: '...',
                          //      user_id: 0,
                          //      screen_name: '...' }
    })
  })
})

License

MIT

Keywords

twitter

FAQs

Package last updated on 24 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts