apitwist-sso-react-native-client
v1.4.3
Published
This is a react native package for Apitwist SSO
Downloads
22
Readme
apitwist-sso-react-native-client
Installation
npm i apitwist-sso-react-native-client
Usage
Run useSSOAuth() hook in your code
import useSSOAuth from "apitwist-sso-react-native-client"
const LoginScreen = () => {
const discovery = {
authorizationEndpoint: 'https://sso.buinbu.com/oauth/authorize',
tokenEndpoint: 'https://sso.buinbu.com/oauth/token',
};
const [login] = useSSOAuth({options: {
clientId: "clientid",
clientSecret: "clientsecret"
}, discovery: discovery});
}
export default LoginScreen;
Run login function on event
<Button
onPress={() => {
const password_token = login()
}}
/>
Using getUserInfo
const [login, getUserInfo] = useSSOAuth({options: {
clientId: "clientid",
clientSecret: "clientsecret"
}, discovery: discovery});
const data = getUserInfo()
If you want to use methods in other screens, except login()
const [getUserInfo] = useSSOAuth({password_token: "xxxxxxxxxx"});
const data = getUserInfo()