title: trouble getting my identity verified by KeyCloak
body: <p>trouble getting my identity verified by KeyCloak.
  I have configured access according to the method in Keycloak's official documentation, but I've encountered a problem when logging in. not granted access</p>
  <p><a href="https://i.stack.imgur.com/B4ORL.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>My code:</p>
  <pre><code>import express from 'express';
  import Keycloak from 'keycloak-connect';
  import bodyParser  from 'body-parser';
  import expressSession from 'express-session';
  import cors from 'cors';
  
  const app = express();
  app.use(bodyParser.json());
  
  // Enable CORS support
  app.use(cors());
  
  // Create a session-store to be used by both the express-session
  // middleware and the keycloak middleware.
  
  const memoryStore = new expressSession.MemoryStore();
  
  app.use(expressSession({
    secret: 'some secret',
    resave: false,
    saveUninitialized: true,
    store: memoryStore
  }));
  
  // Provide the session store to the Keycloak so that sessions
  // can be invalidated from the Keycloak console callback.
  //
  // Additional configuration is read from keycloak.json file
  // installed from the Keycloak web console.
  
  const keycloak = new Keycloak({
    store: memoryStore
  });
  
  app.use(keycloak.middleware({}));
  
  app.get('/service/public', function (req, res) {
    res.json({message: 'public'});
  });
  
  app.get('/user', keycloak.protect('realm:user'), function (req, res) {
    res.json({message: 'secured'});
  });
  
  app.get('/admin', keycloak.protect('realm:admin'), function (req, res) {
    res.json({message: 'admin'});
  });
  
  app.use('*', function (req, res) {
    res.send('Not found!');
  });
  
  app.listen(3000, function () {
    console.log('Started at http://localhost:3000');
  });
  </code></pre>