react-native-social-x-auth
v1.1.0
Published
A lightweight React Native library for authenticating with X (formerly Twitter) using OAuth 2.0 with PKCE. Provides a secure and seamless login experience through Android Custom Tabs and iOS Safari ViewController. Built specifically for integrating X auth
Maintainers
Readme
react-native-social-x-auth
auth 2.0 x
Installation
npm install react-native-social-x-authUsage
You need to create an application and get the client_id
Mandatory for iOS Universal Link and Android App Link for redirect or schema
import { useXAuth } from 'react-native-social-x-auth'
const { startAuth, error } = useXAuth({
clientId: 'client_id',
redirectUri: 'redirect_uri',
scopes: ['users.read', 'offline.access'],
onSuccess: (code, codeVerifier) => {
console.log('Authorization code received:', code, 'Code verifier:', codeVerifier);
},
onError: (err) => {
console.error('Error:', err.message)
},
})The result should be a code - which you can change to access_token and use it to get the user data.
X OAuth Documentation
License
MIT
