Auth0 Home Blog Docs

Auth0-Java 403 Error Grant Type Password not Allowed For Client

java

#1

Hi - when using auth0-java (https://github.com/auth0/auth0-java) , I am getting this error:

com.auth0.exception.APIException:
Request failed with status code 403:
Grant type ‘password’ not allowed for
the client.

I have configured my client to use the default_directory of ‘Username-Password-Authentication’ and have created a user there. The code is below, with actual usernames/passwords substituted of course.

AuthAPI auth = new AuthAPI("mydomain.auth0.com", clientId, clientSecret);

AuthRequest request = auth.login("user@mydomain.com", "password")
        .setAudience(myApiAudience)
        .setScope("openid");
    try {
            TokenHolder holder = request.execute();
            } catch (APIException exception) {
            // api error
            System.out.print(exception);
            } catch (Auth0Exception exception) {
            System.out.print(exception);
            //request error
            }

#2

Please see the following post for a similar resolved issue:

https://community.auth0.com/questions/3944/error-grant-type-password-not-allowed-for-the-clie


#3

Although - the user should easily be able to set these from the web app - having to run an API call to enable this seems like a terrible idea.


#4

You can try selecting the password grant in the advanced settings of your Client, under the Grant types section.


#5