I try to use Auth0 for android I think i have everything done bud still i get this error:
E/LockActivity: Failed to authenticate the user: An error occurred when trying to authenticate with the server.
com.auth0.android.authentication.AuthenticationException: An error occurred when trying to authenticate with the server.
...
my class for run auth:
package com.my.awesome.app.modules;
public class AuthZeroModule extends ReactContextBaseJavaModule {
private ReactApplicationContext mReactContext;
private Lock mLock;
public AuthZeroModule(ReactApplicationContext reactContext) {
super(reactContext);
mReactContext = reactContext;
}
@Override
public String getName() {
return "AuthZero";
}
@ReactMethod
public void authenticate() {
Log.e("LSA", "=============authenticate");
Log.e("LSA", "=============CLIENT: " + AUTH0_CLIENT + " DOMAIN: " + AUTH0_DOMAIN);
Auth0 account = new Auth0("ZXXXXXXXXXXXXXXXXI", "myawesomeauth.eu.auth0.com");
account.setOIDCConformant(true);
mLock = Lock.newBuilder(account, callback)
.withScheme("https")
.withAudience("myapp.middleware.api")
// .withAudience("https://myawesomeauth.eu.auth0.com/authorize")
.allowLogIn(true)
.aut
.build(mReactContext);
mReactContext.startActivity(mLock.newIntent(mReactContext));
}
private LockCallback callback = new AuthenticationCallback() {
@Override
public void onAuthentication(Credentials credentials) {
Log.e("LSA", "OK -->" + credentials.getAccessToken());
}
@Override
public void onCanceled() {
Log.e("LSA", "OK --> User pressed back.");
}
@Override
public void onError(LockException error) {
Log.e("LSA", "OK -->" + error.getMessage());
}
};
}
and inside Auth0 admin i have prepare callback in field 'Allowed Callback URLs':
https://myawesomeauth.eu.auth0.com/androidcom.my.awesome.app/callback,
And i have turn on Use Auth0 instead of the IdP to do Single Sign On
I use same client for IOS and every things work fine bud android have this authentication error.
I will be grateful for every advice ... thanks
Go to the Auth0 Dashboard > Applications > Your App > Show Advanced Settings > Grant Types.
check if the Password grant checked or not
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With