Need help with AuthManager?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

infamous-riddles
122 Stars 19 Forks MIT License 2 Commits 0 Opened issues

Description

Google Sign-In and SmartLock Manager

Services available

!
?

Need anything else?

Contributors list

Android Arsenal

Auth Manager

AuthManager is a library which eliminates the boilerplate of Google SignIn and SmartLock integration.

Usage

compile 'com.github.charbgr:authmanager:1.0'


AuthManager includes all of the managers below.

AuthManager
    .Builder(this)
    .withGoogleApiClient(googleApiClient)
    .withGoogle(this)
    .withHints(this, hintRequest)
    .withSmartLock(this, smartlockRequest)
    .build()

override fun onDestroy() { super.onDestroy() authManager.destroy() }

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) authManager?.handle(requestCode, resultCode, data) }

Standalone Managers

Google Manager

Functionality included: Google Sign-In, Google Sign-Out, Google Revoke Access

GoogleAuthManager
    .Builder(this)
    .withGoogleApiClient(googleApiClient)
    .withGoogleView(this)
    .build()

override fun onDestroy() { super.onDestroy() googleAuthManager?.clear() }

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { RC_SIGN_IN -> googleAuthManager?.handle(resultCode, data) } }

API Overview

fun signInWithGoogle()
fun signOutOfGoogle()
fun revokeGoogleAccess()
fun handle(resultCode: Int, data: Intent?)
fun clear()

Smartlock Manager

Functionality included: SmartLock Credentials Request, SmartLock Credentials Save, SmartLock Credentials Delete

SmartLockManager
    .Builder(this)
    .withGoogleApiClient(googleApiClient)
    .withSmartLockView(this)
    .build()


override fun onDestroy() { super.onDestroy() smartLockManager?.clear() }

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { RC_CREDENTIAL_SAVE -> smartLockManager?.handleCredentialSave(resultCode) RC_CREDENTIALS_REQUEST -> smartLockManager?.handleCredentialRequest(resultCode, data) } }

API Overview

fun requestCredentials()
fun saveCredential(credential: Credential)
fun deleteCredential(credential: Credential?)
fun handleCredentialSave(resultCode: Int)
fun handleCredentialRequest(resultCode: Int, data: Intent?)
fun clear()

Hints Manager

Functionality included: E-mail Addresses Hints

HintsManager
    .Builder(this)
    .withGoogleApiClient(googleApiClient)
    .withHintsView(this)
    .build()


override fun onDestroy() { super.onDestroy() hintsManager?.clear() }

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { RC_HINT_REQUEST -> hintsManager?.handle(resultCode, data) } }

API Overview

fun requestEmailHints()
fun handle(resultCode: Int, data: Intent?)
fun clear()

You need to call in

Activity.onDestroy()
to clear view references otherwise you risk having a memory leak.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.