# Android Lock cannot login via email

**URL:** <https://community.auth0.com/t/android-lock-cannot-login-via-email/75347>\
**Category:** Get Help\
**Tags:** android, lock-android, lock\
**Created:** [December 22, 2021, 4:49pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347 "2021-12-22T16:49:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![customautosys](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/customautosys/32/13540_2.png) [@customautosys](https://community.auth0.com/u/customautosys)\
**Post date:** [December 22, 2021, 4:49pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/1 "2021-12-22T16:49:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 23, 2021, 8:42am UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/2 "2021-12-23T08:42:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![customautosys](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/customautosys/32/13540_2.png) [@customautosys](https://community.auth0.com/u/customautosys)\
**Post date:** [December 28, 2021, 6:01pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/3 "2021-12-28T18:01:23Z")

</div>

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

 ![bildo](https://global.discourse-cdn.com/auth0/original/3X/c/b/cbd5e3619d5ff42716c5048677d0f1b9c908db6c.png)  
By the way, email and password are working fine on desktop. Only Android Lock is having a problem.

---

<div class="post-metadata">

**Author:** ![customautosys](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/customautosys/32/13540_2.png) [@customautosys](https://community.auth0.com/u/customautosys)\
**Post date:** [January 3, 2022, 3:47pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/4 "2022-01-03T15:47:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![chanelnicoleyu97](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chanelnicoleyu97/32/12821_2.png) [@chanelnicoleyu97](https://community.auth0.com/u/chanelnicoleyu97)\
**Post date:** [January 13, 2022, 7:01am UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/5 "2022-01-13T07:01:04Z")

</div>

Thanks for sharing this information. It was useful[.](https://www.skylightpaycard.me/)

---

<div class="post-metadata">

**Author:** ![youtechoblog](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/youtechoblog/32/40535_2.png) [@youtechoblog](https://community.auth0.com/u/youtechoblog)\
**Post date:** [October 11, 2022, 10:10pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/6 "2022-10-11T22:10:01Z")

</div>

Strange, as I never faced such issue[.](https://youtecho.com/betty-jean-harris/)

---

<div class="post-metadata">

**Author:** ![ManuelNuer](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/manuelnuer/32/33331_2.png) [@ManuelNuer](https://community.auth0.com/u/ManuelNuer)\
**Post date:** [December 14, 2022, 1:07pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/9 "2022-12-14T13:07:50Z")

</div>

Same happened with me[.](https://myjdfaccount.top/) Hope you find its solution[.](https://paybyplatema.site/)

---

<div class="post-metadata">

**Author:** ![SamuelChukweze](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/samuelchukweze/32/49612_2.png) [@SamuelChukweze](https://community.auth0.com/u/SamuelChukweze)\
**Post date:** [August 4, 2023, 8:22am UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/11 "2023-08-04T08:22:02Z")

</div>

Can you share it’s solution with me as well[.](https://ehallpass.us/login/) Thanks in advance.

---

<div class="post-metadata">

**Author:** ![HarryKane](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/harrykane/32/49841_2.png) [@HarryKane](https://community.auth0.com/u/HarryKane)\
**Post date:** [August 11, 2023, 4:41pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/12 "2023-08-11T16:41:37Z")

</div>

You can help me, I can help you in solving this issue[.](https://mostlyboating.com/do-canoes-tip-over-easily/)

---

<div class="post-metadata">

**Author:** ![SuzaneIllac](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/suzaneillac/32/49917_2.png) [@SuzaneIllac](https://community.auth0.com/u/SuzaneIllac)\
**Post date:** [September 21, 2023, 11:56am UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/13 "2023-09-21T11:56:37Z")

</div>

Can you also help me with this? I’m also facing this issue[.](https://raiderlinkttu.us/)

---

<div class="post-metadata">

**Author:** ![customautosys](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/customautosys/32/13540_2.png) [@customautosys](https://community.auth0.com/u/customautosys)\
**Post date:** [September 29, 2023, 1:42pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/14 "2023-09-29T13:42:29Z")

</div>

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):

```java
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();
				});
			}
		});
	}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 13, 2023, 1:42pm UTC](https://community.auth0.com/t/android-lock-cannot-login-via-email/75347/15 "2023-10-13T13:42:31Z")

</div>

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