I’m trying to login users with password using Auth0-java using a machine to machine application. I followed “Log In with Password - /oauth/token” from “GitHub - auth0/auth0-java: Java client library for the Auth0 platform”. Here is the snippet of code:
AuthAPI auth = new AuthAPI("{MY-ACCOUNT}.auth0.com",
"{MY-CLIENT-ID}",
"{MY-CLIENT-SECRET}");
AuthRequest request = auth.login(email, password)
.setAudience("https://{MY-ACCOUNT}.auth0.com/users")
.setScope("openid contacts");
TokenHolder holder = request.execute();
I get the following exception:
com.auth0.exception.APIException: Request failed with status code 400: invalid audience specified for password grant exchange
I’m not sure what the audience is supposed to be. In the example on the library’s doc is “https://api.me.auth0.com/users”. Any ideas what could be wrong ?