Twitter Strategy

Introduction

Passport Facebook authentication strategy using OAuth 2.0

Configuration sample object

Below is a configuration sample that is needed for the Facebook strategy to be configured. Follow the steps below the sample to get those configurations.


Configuration Sample
"twitter": {
	"clientID": '%API_key%',
	"clientSecret": 'API_secret_key',
	"callbackURL": 'callback_url',

	//optional
	"userProfileURL": "https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true"
}


Configuration Steps

1 - Create a Twitter application

You must register an app with Twitter in Developers Applications in Twitter's apps menu.

After the application is created, the keys and tokens page views the credentials that should be used in configuring the passport strategy as below


2 - Strategy Configuration

The passport-twitter strategy authenticates users using a Twitter user account and OAuth 2.0 tokens. Consumer Key and Secret granted in the creation of an app should be added to the config file as options so the strategy will be created. The callback URL will be used to receive the access-token, refresh-token, and profile which is the Twitter authenticated user profile.