Socket
Socket
Sign inDemoInstall

get-twitter-bearer-token

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-twitter-bearer-token

Get twitter bearer_token for oAuth


Version published
Weekly downloads
16
increased by100%
Maintainers
1
Install size
1.58 MB
Created
Weekly downloads
 

Readme

Source

get-twitter-bearer-token

This is a convenience method to obtain an application bearer token for the Twitter api. It sends a request to /oauth2/token endpoint with the correctly formatted credentials (base64 encoded consumer key and secret) and headers.

This is only meant to be used once per application/token, since the token needs to be explicitly invalidated to stop working.

Install

npm i

Usage

const getBearerToken = require('get-twitter-bearer-token')

const twitter_consumer_key = 'your-consumer-key'
const twitter_consumer_secret = 'your-consumer-secret'

getBearerToken(twitter_consumer_key, twitter_consumer_secret, (err, res) => {
  if (err) {
    // handle error
  } else {
  
    // bearer token
    console.log(res.body.access_token)
  }
})

FAQs

Last updated on 26 Feb 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc