title: KeyCloak Node.js adapter gives KeyCloak page not found for public clients and access denies for bearer-only clients
body: <p>When I set up a public client in Keycloak, setting all required fields for my local sandbox</p>
  
  <ul>
  <li>Access Type: public</li>
  <li>Valid Redirect URIs: <a href="http://localhost:3000/" rel="nofollow noreferrer">http://localhost:3000/</a>*</li>
  <li>Web Origins: *</li>
  </ul>
  
  <p>I save the Keycloak OIDC JSON from the installation tab to a local <code>keycloak.json</code> file, add my Node.js app and hit <a href="http://localhost:3000/protected" rel="nofollow noreferrer">http://localhost:3000/protected</a>, I get the following page in my browser:</p>
  
  <p><a href="https://i.stack.imgur.com/NGCXL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NGCXL.png" alt="enter image description here"></a></p>
  
  <p>**The url contains an extra <code>/</code> after the <code>auth-server-url</code>. Here is my <code>keycloak.json</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "realm": "keycloak-node-monolith",
    "auth-server-url": "http://localhost:8180/auth/",
    "ssl-required": "external",
    "resource": "keycloak-node-monolith-public",
    "public-client": true,
    "confidential-port": 0
  }
  </code></pre>
  
  <p>The problem is less obvious in case of bearer-only clients, because there is no authentication redirect and you don't see the URL.</p>
  
  <p><strong>In case of bearer-only clients all you see is Access Denied even if you are sending the right bearer tokens to your server.</strong></p>
  
  <p>The root cause of the issue is the same in both cases:
  <strong>Keycloak-connect adds an extra <code>/</code> after the <code>auth-server-url</code>, so you have to remove the <code>/</code> in your <code>keycloak.json</code>.</strong></p>