react-twitter-oauth
React component for a simple OAuth Twitter integration. Forked from (https://github.com/alexandrtovmach/react-twitter-login)
🚀 Get Started
Follow these steps to start using React Twitter Oauth:
-
Installation
# with npmnpm i react-twitter-oauth# with yarnyarn add react-twitter-oauth -
Import and configure component.
This component should be rendered on route that match with one of whitelisted callback URLs of your Twitter app.
import React from "react";import TwitterLogin from "react-twitter-oauth";propsconst authHandler = err dataconsole;;return<TwitterLogin=====/>;; -
REQUEST_TOKEN_API_ENDPOINT get object and send to https://api.twitter.com/oauth/request_token
then the response should be of this kind
-
ACCESS_TOKEN_API_ENDPOINT get object and send to https://api.twitter.com/oauth/access_token
the server response must contain the following data
-
Find more info about keys and Twitter developer apps in official docs.
📖 API
Property | Type | Default | Description |
---|---|---|---|
authCallback | function | required | Callback function which takes two arguments (error, authData) |
consumerKey | string | required | Consumer API Key of your Twitter developer app (not Access Token) |
consumerSecret | string | required | Consumer API Secret of your Twitter developer app (not Access Token Secret) |
requestTokenUrl | string | required | Api endpoint will be used to get request token |
accessTokenUrl | string | required | Api endpoint will be used to get access token |
buttonTheme | enum("light" , "light_short" , "dark" , "dark_short" ) |
"light" |
Button style theme, that based on Twitter Brand Design |
className | string | "" |
Custom class name |
children | React.Component | "" |
Provide any component as a "children" prop to use custom button |