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
npm install react-native-social-x-authsh
npm install react-native-social-x-auth
`
Usage
You need to create an application and get the client_id
developer.x
Mandatory for iOS Universal Link and Android App Link for redirect or schema
`js
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)
},
})
``