diff --git a/docs/README.md b/docs/README.md index 78dd243..1664368 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,15 +1,43 @@ -# Frontegg React Native SDK -![Frontegg_React Native_SDK](/images/frontegg-react-native.png) +

+ Frontegg React Native SDK +

-Welcome to the official **Frontegg React Native SDK** โ€” your all-in-one solution for -integrating authentication and user management into your React Native mobile -app. [Frontegg](https://frontegg.com/) is a self-served user management platform, built for modern -SaaS applications. Easily implement authentication, SSO, RBAC, multi-tenancy, and more โ€” all from a -single SDK. +

Frontegg React Native SDK

-## ๐Ÿ“ฆ Peer Dependencies +

+ Authentication and user management for your React Native app โ€” one package, both platforms. +

-Install the required peer dependencies in your app: +

+ npm version + iOS 14+ + Android API 26+ + React Native 0.63+ + Licence +

+ +--- + +[Frontegg](https://frontegg.com/) is a self-served user management platform for modern SaaS +applications. Drop this SDK in and your app gets a production login screen, a live session, and a +user object โ€” without you writing an auth flow or touching a token. + +| | | +| --- | --- | +| **Hosted or embedded login** | Frontegg's login box, or your own UI on top of the API | +| **Every method your tenants need** | Email, social, SSO, magic link, passkeys, MFA and step-up | +| **Sessions that stay alive** | Tokens refresh in the background, on both platforms | +| **Built for multi-tenant SaaS** | Multi-tenancy, RBAC, entitlements and multi-region support | + +--- + +## Install + +```sh +npm install @frontegg/react-native +``` + +Then the peer dependencies: ```sh # Expo @@ -19,51 +47,87 @@ npx expo install @react-native-async-storage/async-storage @react-navigation/nat npm install @react-native-async-storage/async-storage @react-navigation/native @react-navigation/native-stack react-native-screens react-native-safe-area-context ``` -## ๐Ÿ“š Documentation +**Requirements:** React Native 0.63+ ยท iOS deployment target 14+ ยท Android API 26+ with JDK 17 and +AGP 7.4+. Passkeys additionally need iOS 15+ and Chrome Custom Tabs on Android. -This repository includes: +## Quick start -- A [Get Started](https://react-native-guide.frontegg.com/#/getting-started) guide for quick integration -- A [Setup Guide](https://react-native-guide.frontegg.com/#/setup) with detailed setup instructions -- [Usage Examples](https://react-native-guide.frontegg.com/#/usage) with common implementation patterns -- [Advanced Topics](https://react-native-guide.frontegg.com/#/advanced) for complex integration scenarReact Native -- A [Embedded](https://github.com/frontegg/frontegg-react-native/tree/master/example) example projects to help you get started quickly +**1 ยท Allow the redirect URLs.** In the Frontegg Portal, under **[ENVIRONMENT] โ†’ Authentication โ†’ +Login method**, turn hosted login on and add the shared URL plus one per platform: -For full documentation, visit the Frontegg Developer Portal: -๐Ÿ”— [https://developers.frontegg.com](https://developers.frontegg.com) +``` +{{FRONTEGG_BASE_URL}}/oauth/authorize ---- +# iOS +{{IOS_BUNDLE_IDENTIFIER}}://{{FRONTEGG_BASE_URL}}/ios/oauth/callback -## ๐Ÿ” Native SDK versions +# Android +{{ANDROID_PACKAGE_NAME}}://{{FRONTEGG_BASE_URL}}/android/oauth/callback +https://{{FRONTEGG_BASE_URL}}/oauth/account/redirect/android/{{ANDROID_PACKAGE_NAME}} +``` -The React Native wrapper depends on the underlying native SDKs: +**2 ยท Configure the native projects.** iOS reads a `Frontegg.plist`; Android takes its domain and +client ID from `build.gradle`. Both are covered step by step in the +[Setup guide](https://react-native-guide.frontegg.com/#/setup) โ€” this is the one part that is not +JavaScript, and it differs per platform. + +**3 ยท Wrap your app.** + +```tsx +import { NavigationContainer } from '@react-navigation/native'; +import { FronteggWrapper } from '@frontegg/react-native'; + +export default function App() { + return ( + + + {/* your navigator */} + + + ); +} +``` -- On **Android**, the plugin and example app use `com.frontegg.sdk:android:1.3.35`. -- On **iOS**, the plugin depends on `FronteggSwift` **1.3.11** via CocoaPods. +**4 ยท Read the authentication state** anywhere below it. -After upgrading, run `pod install` in your iOS project and rebuild both platforms. +```tsx +import { View, Button } from 'react-native'; +import { useAuth, login } from '@frontegg/react-native'; ---- +export function MyScreen() { + const { isAuthenticated } = useAuth(); -## ๐Ÿ” Native SDK versions + return ( + + {isAuthenticated ? :