Skip to content

Facebook Login Usage

Serhii Petrosyuk edited this page Apr 19, 2019 · 6 revisions

#

To log in with the Facebook account build a FacebookAuth object and call the signIn() method. Observe the auth result with any LifecycleOwner instance. The signIn() method returns the LiveData object with the AuthResult value type

FacebookAuth.Builder(this)
    .requestEmail()
    .requestProfile()
    .enableSmartLock()
    .build()
    .signIn()
    .observe(this, Observer { authResult ->
        if (it.isSuccess) {
            // Do your further stuff with the [authResult.account] here
        } else {
            // Handle the [authResult.exception] here 
        }
    })

Call the enableSmartLock() if you want to use Smart Lock for Passwords on Android

Clone this wiki locally