Skip to content

A Kotlin library for the Flow Client Library (FCL) that enables Flow wallet authentication on Android devices

Notifications You must be signed in to change notification settings

onflow/fcl-auth-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Android Kotlin library for the Flow Client Library (FCL).

Report a Bug



FCL Auth Android is a Kotlin library for the Flow Client Library (FCL) that enables Flow wallet authentication on Android devices.

Demo

The example app in this project demonstrates how to use FCL inside an Android app.

Installation

You can download the latest version from the GitHub Apache Maven registry.

<dependency>
  <groupId>org.onflow.fcl</groupId>
  <artifactId>fcl-auth-android</artifactId>
  <version>0.1.0</version>
</dependency>

Configuration

You will need to configure your app information before using the authentication library.

FCL Android ships with several built-in wallet providers (Dapper, Blocto), but you can also define custom wallet providers if needed.

import org.onflow.fcl.android.auth.AppInfo
import org.onflow.fcl.android.auth.DefaultProvider
import org.onflow.fcl.android.auth.FCL

val fcl = FCL(
    AppInfo(
        title = "FCL Demo App",
        icon = URL("https://foo.com/bar.png"),
    )
)

fcl.providers.add(DefaultProvider.DAPPER)
fcl.providers.add(DefaultProvider.BLOCTO)

Authenticate

// use inside of an activity class
val context: android.content.Context = this

fcl.authenticate(context, DefaultProvider.DAPPER) { response ->
  System.out.println(response.address)
}

The response variable is of type AuthnResponse, which contains the user's wallet address:

/**
 * Authentication response
 * 
 * @property [address] address of the authenticated account
 * @property [status] status of the authentication (approved or declined)
 * @property [reason] if authentication is declined this property will contain more description
 */
data class AuthnResponse(
    val address: String?,
    val status: ResponseStatus,
    val reason: String?
)

About

A Kotlin library for the Flow Client Library (FCL) that enables Flow wallet authentication on Android devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages