auth_ui_flutter

A flutter plug-in for the native Auth-Core library (Android and iOS).

Installation

First, add auth_ui_flutter as a dependency in your pubspec.yaml file.

Android

Add TekoGoogleRegistryToken to local.properties of this project (contact trung.cs@teko.vn to get the token).

// android/local.properties

TekoGoogleRegistry.password=<your-token>

In project build.grade. Add the following code:

allprojects {
  repositories {
    ...

    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())

    maven {
      setUrl("https://asia-southeast1-maven.pkg.dev/teko-development/teko-mobile-sdks")

      authentication {
        basic(BasicAuthentication)
      }

      credentials {
        username = "_json_key_base64"
        password = properties.getProperty('TekoGoogleRegistry.password')
      }
    }
  }
}

iOS

Setup github access token for accessing Teko iOS frameworks (contact trung.cs@teko.vn to get the token)..

  • Open terminal: touch /.bash_profile; open /.bash_profile (a text editor will be opened)
  • Add a new line: export GITHUB_USER_TOKEN="<your-token>"
  • Save file and go back to terminal: source ~/.bash_profile

Library usage

Get the terraAuthUI instance

Static Method: TerraAuthUI.getInstance(_appName) -> Future<TerraAuthUI>

Should be called in initialize phase of your app and must be called after initilizing TerraApp successful.

Open login form

Method: startLogin(pigeon.LoginUIConfig? loginUIConfig) -> Future<void>

Open the login form with options specified in loginUIConfig

Set display languageCode

Method: setLanguageCode(String languageCode) -> Future<void>

Using LoginUIConfigBuilder to build LoginUIConfig struct

Method: withLocalAssetFilename(String logoImageAssetFilename) -> LoginUIConfigBuilder

Do not allow user to close form without logged in

Method: withAuthenticationCancellable(bool authenticationCancellable) -> LoginUIConfigBuilder

The default account to be used when logging in by username/password

Method: withAccount(String account) -> LoginUIConfigBuilder

Open account input screen and skip login method chosen

Method: withOpenAccountInputDirectly(bool toAccountInputDirectly) -> LoginUIConfigBuilder

Allow edit username or not when at account input screen

Method: setIsAccountEditable(bool isAccountEditable) -> LoginUIConfigBuilder

Build the LoginUIConfig

Method: build() -> LoginUIConfig