Search in sources :

Example 1 with AuthCallback

use of com.auth0.android.provider.AuthCallback in project chefly_android by chef-ly.

the class MainActivity method socialLogin.

private void socialLogin(String connection) {
    // getString(R.string.auth0_domain
    Auth0 auth0 = new Auth0(getString(R.string.auth0_client_id), getString(R.string.auth0_domain));
    WebAuthProvider.init(auth0).withConnection(connection).start(MainActivity.this, new AuthCallback() {

        @Override
        public void onFailure(@NonNull Dialog dialog) {
            dialog.show();
        }

        @Override
        public void onFailure(final AuthenticationException exception) {
            // Show error to the user
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    Log.d(TAG, "LOGIN FAIL");
                    String errorMsg = "Sign in request failed";
                    showToast(errorMsg);
                }
            });
        }

        @Override
        public void onSuccess(@NonNull Credentials credentials) {
            // Navigate to your next activity
            startRecipeListActivity("aaa");
        }
    });
}
Also used : Auth0(com.auth0.android.Auth0) AuthenticationException(com.auth0.android.authentication.AuthenticationException) AuthCallback(com.auth0.android.provider.AuthCallback) Dialog(android.app.Dialog) Credentials(com.auth0.android.result.Credentials)

Aggregations

Dialog (android.app.Dialog)1 Auth0 (com.auth0.android.Auth0)1 AuthenticationException (com.auth0.android.authentication.AuthenticationException)1 AuthCallback (com.auth0.android.provider.AuthCallback)1 Credentials (com.auth0.android.result.Credentials)1