Auth0 Home Blog Docs

Java Api com.auth0.net.TokenRequest Content-Type issue

Using com.auth0:auth0:1.15.0
When creating a TokenRequest the content type seems to be sent as application/json
but other OAuth clients are sending application/x-www-form-urlencoded and servers seem to be expecting application/x-www-form-urlencoded.

TokenRequest extends CustomRequest which forces all createRequest to use content-type application/json

Auth0 docs show application/x-www-form-urlencoded

It looks like the Java api doesn’t provide a way to override this default content-type.

	AuthAPI api = new AuthAPI("", "", "");

	TokenRequest tokenRequest = (TokenRequest) api.requestToken("audience");
	TokenHolder tokenHolder = tokenRequest.execute();

	System.out.println(tokenHolder.getAccessToken());
	System.out.println(tokenHolder.getExpiresIn());
	System.out.println(tokenHolder.getTokenType());
1 Like