0.1.1-alpha.0 • Published 2 years ago

react-native-strapi-auth-providers v0.1.1-alpha.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-strapi-auth-providers

Use OAuth and OAuth2 providers through Strapi to enable authentication in your React Native application

Installation

yarn add react-native-webview react-native-strapi-auth-providers
npx pod-install

Usage

import { StyleSheet, View, Text, Alert } from 'react-native';
import LoginWithAuthStrapi from 'react-native-strapi-auth-providers';

export default function App() {
  const [token, setToken] = useState<>();
  const [open, setOpen] = useState(true);

  return (
    <View style={styles.container}>
      <LoginWithAuthStrapi
        isVisisble={open}
        provider="instagram"
        lang="pt-BR"
        backendUrl="https://api.mystrapiserver.com"
        redirectUrl="https://www.myredirectpage.com/redirect"
        onCancel={() => {
          setOpen(false);
        }}
        onSuccess={(token) => {
          Alert.alert(`success ${token?.jwt}`);
          setToken(token.jwt);
          setOpen(false);
        }}
        onError={(m) => {
          Alert.alert(`error ${m}`);
        }}
      />
    </View>
  );
}

// ...

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library