Android Lock cannot login via email

Hi, Lock 11 user on Android here. I am unable to login via email on Android lock as I continually get an Exception that I am unauthorised (this is not the same as password incorrect - for that the lock screen doesn’t even proceed as it immediately shows that the password is wrong). I have turned off the OIDC Conformant switch and enabled Password authentication in the application settings. Any idea what is wrong? LinkedIn and Twitter login are working fine.

Hey there!

In order to handle that most effectively can I ask you to raise it as a GitHub issue in the repo so we can discuss that directly with the repo maintainers? Thank you! Once you have a link to it you can share it here so we can ping them.

Hi I can’t create an issue, it tells me either to come here or read the library docs:


By the way, email and password are working fine on desktop. Only Android Lock is having a problem.

I decided to allow only LinkedIn and Twitter login to my app for my own reasons, so I’ll leave this issue for now since it no longer has any practical implications for the time being.

Thanks for sharing this information. It was useful.

Strange, as I never faced such issue.

Same happened with me. Hope you find its solution.

Can you share it’s solution with me as well. Thanks in advance.

You can help me, I can help you in solving this issue.

Can you also help me with this? I’m also facing this issue.

Hi I can’t remember by now exactly what is it I did that solved the problem but I’m donating my code here (for personal use only):

package com.customautosys.tuxfight.android;

import android.content.Context;
import android.webkit.CookieManager;
import android.webkit.WebStorage;
import android.webkit.WebView;

import com.auth0.android.Auth0;
import com.auth0.android.authentication.AuthenticationException;
import com.auth0.android.callback.Callback;
import com.auth0.android.lock.AuthenticationCallback;
import com.auth0.android.lock.Lock;
import com.auth0.android.provider.WebAuthProvider;
import com.auth0.android.result.Credentials;
import com.badlogic.gdx.LifecycleListener;
import com.badlogic.gdx.utils.ObjectMap;
import com.customautosys.tuxfight.R;

import java.util.concurrent.CompletableFuture;

public class LoginManager extends com.customautosys.tuxfight.multiplayer.LoginManager{
	protected Lock lock=null;
	protected static CompletableFuture<ObjectMap<String,String>> values=null;
	@Override
	public CompletableFuture<ObjectMap<String,String>> login(){
		values=new CompletableFuture<>();
		AndroidLauncher androidLauncher=AndroidLauncher.getInstance();
		Context applicationContext=androidLauncher.getApplicationContext();
		if(lock==null){
			lock=Lock.newBuilder(new Auth0(applicationContext),new AuthenticationCallback(){
				@Override
				public void onAuthentication(Credentials credentials){
					ObjectMap<String,String> strings=new ObjectMap<>();
					strings.put("access_token",credentials.getAccessToken());
					strings.put("id_token",credentials.getIdToken());
					strings.put("refresh_token",credentials.getRefreshToken());
					strings.put("scope",credentials.getScope());
					strings.put("token_type",credentials.getType());
					strings.put("expires_in",Long.toString(credentials.getExpiresAt().getTime()));
					values.complete(strings);
				}

				@Override
				public void onError(AuthenticationException error){
					error.printStackTrace();
					values.complete(null);
				}
			})
				.closable(true)
				.withScheme(androidLauncher.getString(R.string.com_auth0_scheme))
				.withScope("openid profile email app_metadata user_metadata client_metadata")
				.withAudience("https://customautosys.auth0.com/userinfo")
				.build(androidLauncher.getApplicationContext());
			androidLauncher.addLifecycleListener(new LifecycleListener(){
				@Override
				public void pause(){}

				@Override
				public void resume(){}

				@Override
				public void dispose(){
					lock.onDestroy(applicationContext);
					lock=null;
				}
			});
		}
		androidLauncher.startActivity(lock.newIntent(applicationContext));
		return values;
	}

	@Override
	public void logout(){
		WebAuthProvider.logout(lock.getOptions().getAccount()).withReturnToUrl("https://customautosys.auth0.com/v2/logout?client_id=dRpFgfjdLerW3PNMsTiIkONwteyd0Tyr&returnTo=https%3A//customautosys.com/ad.php&federated").withScheme("com.customautosys.tuxfight").start(AndroidLauncher.getInstance(),new Callback<Void,AuthenticationException>(){
			@Override
			public void onSuccess(Void unused){
				clearCookies();
			}

			@Override
			public void onFailure(AuthenticationException e){
				e.printStackTrace();
				clearCookies();
			}

			protected void clearCookies(){
				AndroidLauncher.getInstance().runOnUiThread(()->{
					CookieManager cookieManager=CookieManager.getInstance();
					cookieManager.removeAllCookies(value->{});
					cookieManager.flush();
					WebView webView=new WebView(AndroidLauncher.getInstance().getApplicationContext());
					webView.clearFormData();
					webView.clearHistory();
					webView.clearSslPreferences();
					WebStorage.getInstance().deleteAllData();
				});
			}
		});
	}
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.