How to pass extra login parameter via auth0-java SDK auth.login method

Please include the following information in your post:

  • Which SDK this is regarding: auth0-java
  • SDK Version: 1.42.0
  • Platform Version: java 1.8.0_322

Hi team, I’m trying to use auth0-java SDK to do Log In with Password Realm - /oauth/token. Following is my code to login:

CustomRequest<TokenHolder> request = auth.login(
                .setScope("openid profile email offline_access")
                .addParameter("extra_param", "extra_param_value");
TokenHolder holder = request.execute();

In Auth0 rules I’m using the following to get the parameter:


Then I got the following error:
Request failed with status code 500: Cannot read property ‘extra_param’ of undefined.

If I disable the Auth0 rule, I’m able to login via this auth.login.

Actually I succeeded in passing extra parameters by using another method auth.authorizeUrl, the code is like:

String url = this.auth.authorizeUrl("uri")
                .withScope("openid profile email offline_access")
                .withParameter("extra_param", "extra_param_value")

By using this generated url, I successfully logged in, and the Auth0 rule is also able to get the extra parameter. So I don’t know why this doesn’t work for auth.login method. Hope anyone can help me with this issue.

Thank you in advance!