Configuration
Introduction
This section describes the first steps to integrate the OneWelcome Flutter SDK with an existing Flutter project. In this topic we will describe how you can configure your project to use our SDK.
The SDK consists of a Flutter wrapper for the OneWelcome Android and iOS SDKs. You will need explicit access to the Android and iOS SDKs, the wrapper is public.
Requirements
Android:
- Minimum API level 23
For more information see Android SDK Documentation
iOS:
- Minimum iOS version 13
For more information see iOS SDK Documentation
Flutter:
- Minimum Flutter version 1.12.0
Configure your project
The following steps describe how to configure our native Android and iOS SDKs for your Flutter project.
Adding the dependency
To start using the plugin, you will need to follow a few simple steps:
- Open pubspec.yaml file in your project
- Add dependency
- Onegini: ^x.y.z
. - Run
flutter pub get
command.
SDK Configuration
As mentioned previously, the Flutter SDK is a wrapper for the OneWelcome Android and iOS SDKs. For this reason, the wrapper SDKs require access to the native SDKs to function which can be done through the following steps:
- Get access to https://repo.onewelcome.com/artifactory/onegini-sdk through support
- Use https://github.com/onewelcome/sdk-configurator on your application
Android
- Modify
android/app/build.gradle
1.1. Add to android section:
1.2. Add to android -> defaultConfig section:
- Add to
android/app/proguard-rules.pro
- Add to
android/build.gradle [allprojects.repositories]
- Setup the Onegini config: Generate a
OneginiConfigModel
andkeystore.bks
with SDK Configurator.
More information HERE, section: Running the SDK Configurator.
- Setup the
SecurityController
( not required).
In order to change security options you should create your own instance of SecurityController and handle it to the plugin. By default security options brought from com.onegini.mobile.SecurityController.
More information HERE, section: SecurityController.
- In your
MainActivity
class, in theonCreate()
method you must addOneginiConfigModel
andSecurityController
.
- OneWelcome plugin uses deep links for communication between WEB pages and your app.
Modify android/app/src/main/AndroidManifest.xml
. Add <intent-filter>
to your MainActivity
(pic.3) for listening browser redirects. scheme="oneginiexample"
should be changed to your from OneginiConfigModel
(will be provided by onegini-sdk-configurator)
IOS
- The OneWelcome plugin is uploaded to the OneWelcome Artifactory repository. In order to let CocoaPods use an Artifactory repository you need to install a specific plugin.
gem install cocoapods-art
- The OneWelcome repository is not a public repository. You must provide credentials in order to access the repo. Create a file named
.netrc
in your Home folder (~/) and add the following contents to it:
- Replace the and with the credentials that you use to login to <support.onegini.com>.
- The Onegini CocoaPods repository must be added to your local machine using the following command:
pod repo-art add onegini htps://repo.onewelcome.com/artifactory/api/pods/cocoapods-public
- In order to update the Repository you must manually perform an update:
pod repo-art add onegini https://repo.onewelcome.com/artifactory/api/pods/cocoapods-public
- Add next to ios/Podfile (before app target):
- Run
pod install
- Add
SecurityController.h
andSecurityController.m
as described HERE to native's part of code.
Linking Native Code
For iOS we require an additional step to link native code in the xCode project.
IOS >= 12.0
Run this command in your project main folder: cd ios && pod install