<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>Today I've been having a lot of trouble creating a gateway. When I put in the gateway name, description, configuration endpoint and configuration endpoint credentials, I kept getting &quot;Authentication to the gateway failed. Perhaps check that your credentials
 are correct.&quot; &nbsp;I was able to log in to Keycloak using the apimanager credentials, so I know they are correct.</div>
<div><br>
</div>
<div>In the Keycloak log I see:</div>
<div><br>
</div>
<div>
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;">WARN &nbsp;[org.keycloak.events] type=LOGIN_ERROR, realmId=apiman, clientId=apiman-gateway-api,&nbsp;<b><font color="#ff2600">userId=null</font></b>, ipAddress=[x.x.x.x], error=not_allowed, grant_type=password,
 auth_method=oauth_credentials, client_auth_method=client-secret</blockquote>
</div>
<div><br>
</div>
<div>I couldn't figure out why the userId should be null. The apimanager user has the apipublisher role, the apiman-gateway-api client has the proper valid redirect URI and uses the openid-connect protocol with a confidential access type, and the application
 configurations are using the correct client secret.</div>
<div><br>
</div>
<div>I was finally able to fix the issue by enabling direct access grants on the apiman-gateway-api client. &nbsp;Should this be part of the default configuration for apiman-gateway-api in the apiman-realm.json, file, or is there something I'm misssing?</div>
<div><br>
</div>
</div>
</body>
</html>