Auth0 Home Blog Docs

Can we send custom properties in the login request using the Java Library?



Hello. We have a rule setup to check our login requests for a custom property named “x_client_id” that is passed in the request body to an /oauth/token call. However we are not able to add this property using the Java library from GitHub as there doesn’t seem to be a function to add custom properties to the auth.login(…) call. Everything works great using Postman.

POST /oauth/token
        "grant_type": "",
        "client_id": "xxx",
        "client_secret": "yyy",
        "username": "",
        "password": "zzz",
        "scope": "openid profile offline_access",
        "realm": "Username-Password-Authentication",
        "audience": "",
        "x_client_id": "ANBC"

Is there something that we aren’t seeing in the Java library? If not, is there any chance we could get something added in a newer version to do this? Maybe a function that accepts a Map of key/value pairs to add to the request body?


Maybe this has something to do with properly using (custom claims)[] to pass custom data in the token for OIDC compliant apps?


No I’ve got the custom claims working perfectly. It’s more a limitation on the Java library. It would be handy if we could get another setter that took in a Map and would add the values in the map to the request. Maybe something like…

Map<String, Object> customProps = new HashMap<>();
customProps.put("x_client_id", "ABCD");

AuthRequest request = auth.login("", "password123", "Username-Password-Authentication")
        .setScope("openid contacts")