Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rettiwt-auth

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rettiwt-auth

A library for authenticating aagainst Twitter API

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
increased by34.05%
Maintainers
1
Weekly downloads
 
Created
Source

Rettiwt-Auth

A library for authenticating against Twitter API

Rettiwt-Auth is a library that can be used to to get the necessary authentication tokens that can be used to authenticate against Twitter API.


Prerequisites

  • NodeJS 18.14.2

Installation

  1. Initialize a new npm project using the command npm init
  2. Install the package either via npm or yarn
    • For npm, use the command npm install --save rettiwt-auth
    • For yarn, use the command yarn add rettiwt-auth

Types of authentication

Before getting started, it is important to know what are the different authentcation options available and what type of data can be accessed using each authentication method.

The following are the two types of authentcation methods available:

  1. Guest Authentication, with which, the following data can be accessed:
    • Tweet Details
    • User Details
    • User Tweets
  2. User Authentication, with which, the following data, in addition to guest, can be accessed:
    • Tweet Likes
    • Tweet Retweets
    • Tweet Search
    • User Followers
    • User Following
    • User Likes

Additional information

To learn more, please refer to the full documentation of the Auth class.


Getting started

The following examples will help you to get started with using the library:

1. Authenticating as a guest user

import { Auth } from 'rettiwt-auth';

new Auth().getGuestCredential().then(credential => {
    ...
})

Where,

  • credential is the generated guest credential.

2. Authenticating as a logged-in user

import { Auth } from 'rettiwt-auth';

new Auth().getUserCredential({
    email: 'account_email',
    userName: 'account_username',
    password: 'account_password
}).then(credential => {
    ...
})

Where,

  • account_email is the email id associated with your Twitter account.
  • account_username is the username associated with your Twitter account.
  • account_password is the password to your Twitter account.
  • credential is the generated user credential.

Authenticating against Twitter API

After the credentials have been generated:

  1. Generate the credential using any one of the two methods given above.
  2. Use the toHeader() method on the returned credential, which converts the credential into HTTP headers.
  3. Add the returned HTTP headers to the headers of the requests made to Twitter API.

FAQs

Package last updated on 16 Jun 2023

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc