Expo
Rownd bindings for Expo
Prerequisites
You must be using React Native v0.64 or higher.
Must be an ejected Expo app which can be bare React Native or use an Expo development build. Instructions for bare React Native app can be found here.
Installation
First, install the Rownd SDK for Expo.
Expo development
- Add
@rownd/react-native
as a plugin to yourapp.json
file.
- Install Expo BuildProperties to set iOS/Android versions
- Add
expo-build-properties
as a plugin to yourapp.json
file. Ensure the Sdk versions match or are above provided iOS/Android versions.
- (optional) Enable Apple sign-in for iOS in your
app.json
file.
- (optional) Enable Google sign-in for iOS. Add your Google IOS Client ID client as a URL Scheme in your
app.json
file.
Enable deep linking
Rownd supports automatically signing-in users when they initially install your app or when they click a sign-in link when the app is already installed. Follow instructions below to setup.
-
Visit the Rownd platform and go to the Sign-in methods page. Open the Mobile app settings modal and (1) create a subdomain and (2) fill out the iOS/Android settings.
-
Enable deep linking for Expo using
app.json
and<subdomain>
created in the Rownd platform.
File: app.json
Usage
The Rownd SDK includes a context provider that will enable any component of your app to access authentication state and user data.
Before you can use the SDK, you'll need to obtain an App Key from the Rownd Dashboard.
Later on within your app's components, you can use the Rownd hook to access the Rownd browser API:
API reference
Most API methods are made available via the Rownd Provider and its associated
useRownd
React hook. Unless otherwise noted, we're assuming that you're using
hooks.
requestSignIn()
Trigger the Rownd sign in dialog
Property | Type | Description |
---|---|---|
method | email phone apple google passkey | Requests a sign-in, but with a specific authentication provider (e.g., Sign in with Apple). Rownd treats this information as a method. If the specified authentication provider is enabled within your Rownd app configuration, it will be honored. If not, Rownd will fall back to the default flow. |
intent | sign_in sign_up | This option applies only when you have opted to split the sign-up/sign-in flow via the Rownd dashboard. Valid values are sign_in or Sign_up . If you don’t set this value, the user will be presented with the unified sign-in/sign-up flow. Please reach out to support@rownd.io to enable. |
postSignInRedirect (Not recommended) | String | If a subdomain is provided in the Rownd dashboard, this behavior will work by default. The URL to redirect to after the user has signed in. This can be used for deep-linking within the app or to ensure that the user is redirected back into the app after completing a sign-in from email or text message. |
signOut()
Sign out the user and clear their profile, returning them to a completely unauthenticated state.
getAccessToken()
Retrieves the active, valid access token for the current user.
is_authenticated
Indicates whether the current user is signed in or not.
access_token
Represents the current access token for the user.
user
Represents information about the current user, specifically their profile
information. In the example below, we use the existing data to display the
current value of first_name
in a form field, update a local copy of that data
as the user changes it, and then save the changes to Rownd once the user submits
the form.
Merge data into the user profile
Set a specific field in the user profile