Socket
Socket
Sign inDemoInstall

twauth

Package Overview
Dependencies
4
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    twauth

Command line tool to quickly authenticate a user against the Twitter API


Version published
Weekly downloads
0
Maintainers
1
Install size
7.28 MB
Created
Weekly downloads
 

Readme

Source


twauth

Command line tool to quickly authenticate a user against the Twitter API.

In some cases, you might have an app registered with the Twitter Developer website, but you don’t have the API keys you need to use them

Usage

You can quickly run twauth from any computer with npm or pnpm installed by running:

npx twauth
# or
pnpx twauth

Example output:

🐦️ Twitter API User Authorisation Tool

To get started, visit https://developer.twitter.com/ and create an API
application. Enable user authentication for OAuth 1.0a. You can enter any URL
under Callback URL, as it won’t be used by this tool.

When you’re ready, enter your API Key and Secret:
? API Key: 01234567890ABCDEFGabcdefg
? API Key Secret: 01234567890ABCDEFGabcdefg01234567890ABCDEFGabcdefg

Visit this URL in your browser to authorize your account:
https://api.twitter.com/oauth/authorize?oauth_token=123-4567890ABCDEFGHabcdefgh

? Paste the PIN here: 1234567

Access token:  123456789-ABCDEFGabcdefg0123456789ABCDEFGabcdefg01
Access secret: ABCDEFGabcdefg0123456789ABCDEFGabcdefg0123456

Now save these two values, along with your origional consumer key and secret,
and use them in your Twitter app. Have fun!

Environment

You can automate twauth by setting some environment variables:

TWITTER_CONSUMER_KEY

Set the OAuth 1.0a consumer key to use. Also aliased as TWITTER_API_KEY.

TWITTER_CONSUMER_SECRET

Set the OAuth 1.0a consumer secret to use. Also aliased as TWITTER_API_SECRET.

TWAUTH_OPEN_BROWSER

Set this to false to disable automatically opening the user’s default browser to the Twitter authorisation page. You can also pass --no-open-browser as a flag when running twauth.

Automation example

$ TWITTER_CONSUMER_KEY=01234567890ABCDEFGabcdefg \
  TWITTER_CONSUMER_SECRET=01234567890ABCDEFGabcdefg01234567890ABCDEFGabcdefg \
  TWAUTH_OPEN_BROWSER=false \
  npx twauth

Credits

Released and maintained by Adam Demasi (@kirb).

Based on a gist originally written by Tane Piper.

License

Licensed under the Apache License, version 2.0. Refer to LICENSE.md.

Keywords

FAQs

Last updated on 23 Feb 2022

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