Last active
September 18, 2018 21:50
-
-
Save adrianhall/a1941b163864a78b796e8e790cfad6ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Configure the Auth0 requirements | |
| val auth0Settings = Auth0(this).apply { | |
| isOIDCConformant = true | |
| } | |
| val audience = String.format("https://%s/userinfo", resources.getString(R.string.com_auth0_domain)) | |
| loginFormAuth0LoginButton.onClick { | |
| WebAuthProvider.init(auth0Settings) | |
| .withAudience(audience) | |
| .start(this@AuthenticatorActivity, object : AuthCallback { | |
| override fun onSuccess(credentials: Credentials) { | |
| runOnUiThread { toast("Auth0 Authenticated Successfully") } | |
| Log.d(TAG, "ID Token = ${credentials.idToken}") | |
| } | |
| override fun onFailure(dialog: Dialog) { | |
| Log.d(TAG, "Auth0 Error displayed in dialog") | |
| runOnUiThread { dialog.show() } | |
| } | |
| override fun onFailure(exception: AuthenticationException?) { | |
| runOnUiThread { toast("Auth0 Authentication Failed") } | |
| Log.e(TAG, "Auth0 Error: ${exception?.localizedMessage}") | |
| } | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment