Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Last active May 14, 2019 20:29
Show Gist options
  • Save adrianhall/047f32b470308ea60a70a548cdefb0bb to your computer and use it in GitHub Desktop.
Save adrianhall/047f32b470308ea60a70a548cdefb0bb to your computer and use it in GitHub Desktop.
// Register the callback for the Facebook authentication
LoginManager.getInstance().registerCallback(callbackManager, object : FacebookCallback<LoginResult> {
override fun onSuccess(result: LoginResult?) {
Log.d(TAG, "Facebook token = ${result?.accessToken?.token}")
toast("Access Token received")
}
override fun onCancel() {
Log.d(TAG, "Facebook authentication is cancelled")
toast("Facebook Authentication is cancelled")
}
override fun onError(error: FacebookException?) {
Log.e(TAG, "Facebook Authentication failed: ${error?.message}")
toast("Facebook Authentication failed: ${error?.message}")
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment