FaS eKYC Flutter

pub package

A flutter package from FaS eKYC for connecting to FaS eKYC SDK

Prerequisites

Android

On Android you must first set the minSdkVersion in the build.gradle file:

defaultConfig {
   ...
   minSdkVersion 18
   ...

If at all possible, when registering your application on the OAuth provider try not to use HTTPS as the scheme part of the redirect uri, because in that case your application won't intercept the server redirection, as it will be automatically handled by the system browser (at least on Android). Just use a custom scheme, such as "my.test.app" or any other scheme you want.

If the OAuth2 server allows only HTTPS uri schemes, refer to the FAQ section.

Again on Android, if your application uses the Authorization Code flow, you first need to modify the AndroidManifest.xml file adding the intent filter needed to open the browser window for the authorization workflow. The library relies on the flutter_web_auth package to allow the Authorization Code flow.

AndroidManifest.xml

<activity android:name="com.linusu.flutter_web_auth.CallbackActivity" >
	<intent-filter android:label="flutter_web_auth">
		<action android:name="android.intent.action.VIEW" />
		<category android:name="android.intent.category.DEFAULT" />
		<category android:name="android.intent.category.BROWSABLE" />
		<data android:scheme="my.test.app" />
	</intent-filter>
</activity>

iOS

On iOS you need to set the platform in the ios/Podfile file:

platform :ios, '11.0'

Installation

Add this to pubspec.yaml

dependencies:
  sura_flutter: ^0.3.1

Usage

You just call FaSeKYCButton to your widget tree.

Widget _buildLoginButton() {
    return Padding(
      padding: const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 50),
      child: FaSeKYCButton(
        clientId: "your client id",
        clientSecret: "your client secret",
        redirectUri: 'your return url',
        customUriScheme: 'your customer schema uri',
        scopes: scope,
        child: Padding(
          padding: const EdgeInsets.symmetric(vertical: 4.0),
          child: Row(
            children: [
              Container(
                height: 50,
                width: 50,
                child: Center(
                    child: Image.asset('assets/images/ekyc_white_logo.png')),
              ),
              SizedBox(
                width: 8.0,
              ),
              Container(
                height: 30,
                child: VerticalDivider(
                  color: Colors.white,
                ),
              ),
              Expanded(
                flex: 2,
                child: Center(
                  child: Text(
                    "ផ្ទៀងផ្ទាត់",
                    style: TextStyle(
                        color: Colors.white,
                        fontFamily: 'khFont',
                        fontSize: 16.0),
                  ),
                ),
              ),
            ],
          ),
        ),
        onSuccess: (personInfoModel) {
          print(personInfoModel);
        },
        onUserCancel: (String message) {
          showAlertDialog(context, message);
        },
      ),
    );
  }

After calling FaSeKYCButton above, you just input your credential of Oauth2.

Libraries

fasekyc_flutter