@brightlayer-ui/react-native-auth-workflow
TypeScript icon, indicating that this package has built-in type declarations

5.2.0 • Public • Published

React Native Auth Workflow

npm (scoped) codecov

The React Native Auth Workflow package provides a consistent authentication and registration experience across Eaton mobile applications using React Native.

This includes pre-build implementations of the screens for Login, Forgot Password, Contact Information, Self-Registration, Registration By Invitation, and Change Password.

Integrating the user interface into your application is as easy as providing the API calls for the various authentication and registration actions performed by the user. The AuthNavigationContainer automatically handles the presentation of the non-secure (pre-authorization) and secure (custom application) portions of a mobile application.

iOS

Login iOS Home iOS Password iOS

Android

Login Android Home Android Password Android

Compatibility

This package has a peer dependency on React Native Paper.

  • @brightlayer-ui/react-auth-workflow @1.x --> react-native-paper @3.x
  • @brightlayer-ui/react-auth-workflow @2.x --> react-native-paper @4.x

Installation

To install the latest version of this package, run:

npm install --save @brightlayer-ui/react-native-auth-workflow
// or
yarn add @brightlayer-ui/react-native-auth-workflow

Integration

You have two options for using this package in your application. You can manually integrate the package into an existing project, or you can start a project using the /example project provided in the package.

To integrate the package into an existing project, read our Existing Project Integration instructions. Even if you are starting from scratch, it may be useful for you to refer to the example project while getting started.

To use the example project as a starting point, read our Sample Project Integration instructions.

Usage (Security State)

After setup, you are now able to access various security actions and state from within your application. Importing useSecurityActions and useSecurityState allows you use these hooks as follows:

import { useSecurityActions, useSecurityState } from '@brightlayer-ui/react-native-auth-workflow';

const securityActions = useSecurityActions();
const securityState = useSecurityState();

The securityActions allows you to access actions related to user authentication and de-authentication. You can call securityActions.onUserNotAuthenticated(); to un-authenticate (i.e. log user out) from the application.

The securityState allows you to access state related to security, such as the currently authenticated user's email (securityState.email).

More information about React Native Auth Workflow's exported objects can found in the API documentation.

Deep Linking

The following is a list of the screens and their parameters which a deep link may launch to:

  • login: the login screen.
  • PasswordResetInitiation: the first screen of the Password Reset flow.
  • PasswordResetCompletion: the later half of the Password Reset flow, takes parameter code and email.
  • RegistrationInvite: the Registration via Invitation flow, takes parameter code and email.
  • Registration: the later half of the Self Registration flow, takes parameter: code and email.
  • SupportContact: the Contact Support screen.
  • Test iOS simulator with xcrun simctl openurl booted authui://invite/8k27jshInvite234Code
  • Test Android with adb shell am start -W -a android.intent.action.VIEW -d "authui://invite/8k27jshInvite234Code" com.shiverware.eaton.authui
  • Test on device from browser authui://invite/8k27jshInvite234Code

Note that the authui:// prefix is set by your application, as in the file at example/src/navigation/DeepLinking.ts.

APIs

More information about React Native Auth Workflow's exported objects and functions can found in the API documentation.

Language Support

For information about supporting multiple languages, refer to our Language Support guidelines.

Theming

For information about supporting different themes, refer to our Theme Support guidelines.

Contributors

To work on this package as a contributor, first clone down the repository:

git clone https://github.com/etn-ccis/blui-react-native-workflows
cd react-native-workflows/login-workflow

You can install all necessary dependencies and run the demo project by running:

yarn start:example
// or
yarn start:example-android

If you make changes to the library components and want to link them to the running example project, you can run:

yarn link:components

You can build the library by running:

yarn build

You can run the Lint checks, prettier formatter, typescript validator, and unit tests by running:

yarn validate

You can update the auto-generated licenses.md file by running:

yarn generate:licenses

Dependencies (3)

Dev Dependencies (58)

Package Sidebar

Install

npm i @brightlayer-ui/react-native-auth-workflow

Weekly Downloads

2,234

Version

5.2.0

License

BSD-3-Clause

Unpacked Size

4.13 MB

Total Files

276

Last publish

Collaborators

  • brightlayerui