Skip to content

Latest commit

 

History

History
81 lines (53 loc) · 4.4 KB

README.md

File metadata and controls

81 lines (53 loc) · 4.4 KB

example-app-react-native

The React Native Example App is using the Onewelcome React Native SDK to perform secure authentication and resource calls.

Getting started

  1. npm install OR yarn

  2. Make sure to folow the SDK Configuration and Resolving dependecies sections.

  3. run yarn android or yarn ios

Note if you encounter an error No simulator available with name "iPhone 13" run the command with a proper simulator, e.g. yarn ios --simulator="iPhone 14"

SDK Configuration

  1. Get access to https://repo.onegini.com/artifactory/onegini-sdk
  2. Use https://github.com/Onegini/onegini-sdk-configurator on your application (instructions can be found there)

Resolving dependencies (android)

Before you can compile the application it must be able to resolve it's dependencies. The Onegini Android SDK is one of those dependencies. We have an Artifactory repository that distributes the required dependencies. Make sure that you have access to the Onegini Artifactory repository (https://repo.onegini.com). If you don't have access, no problem just go to the App developer quickstart and perform the first step. Access to Artifactory is required to let Gradle download the Onegini Android SDK library.

When you have access you have to make sure that your Artifactory username and password are set in the gradle.properties file in your Gradle user home (e.g. ~/.gradle):

Example contents of the gradle.properties file in you Gradle user home:

artifactory_user=<username>
artifactory_password=<password>

See the documentation below for instructions on setting Gradle properties: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties

Resolving dependencies (iOS)

Setup access to the Onegini Cocoapods repository

The Example app includes the Onegini SDK as a Cocoapod. In order to let Cocoapods download it you need to setup your account details so the SDK can be automatically downloaded:

  1. Make sure that you have access to the Onegini Artifactory repository (https://repo.onegini.com). If not please follow first step of App developer quickstart.
  2. Follow Setting up the project guide in the Onegini SDK documentation for instructions on configuring access to the Onegini Cocoapods repository.

Note Don't forget to update the Onegini Cocoapods repository with the following command: pod repo-art update onegini. If you don't update the repo it may be that the SDK dependency cannot be found. If that is the case be sure to execute the command above.

Setup the Cocoapods dependencies

  1. Run pod install to correctly setup the Cocoapods dependencies
  2. Make sure that you open the project referring to RNExampleApp.xcworkspace in Xcode or AppCode.

Providing token server configuration

The example app is already configured with the token server out of the box for both Android and iOS.

Changing the configuration

If there is a need to change the token server configuration within the example app it is going to be best to do it using the Onegini SDK Configurator. Follow the steps as described in: https://github.com/onewelcome/sdk-configurator

You will need to set the configuration seperately for iOS and Android.

Local Development of SDK using the example app

The SDK can be developed locally using the example app. React Native does not support symlinking with dependencies in the node_modules folder because of the metro bundler see issue.

In order to develop the sdk you can use an npm package called yalc

This package allows us to set up a local npm repository to publish our SDK to. To get started, install yalc following their instructions.

In the SDK folder run: yalc publish

In the example app folder run yalc add @onewelcome/react-native-sdk

After making changes to the SDK you can run yalc publish --push. This will automatically update the dependency in the example app aswell.