[keycloak-user] bearer auth only in keyclaok secured rest API(node js)

Saransh Kumar skm.8896 at gmail.com
Mon Feb 27 09:19:37 EST 2017


Hello,
I have used bearer auth only in my REST API, and I am sending an
Authorization Bearer header in GET request from the front end.

*Protect.js*
......
return function protect (request, response, next) {
    if (request.kauth && request.kauth.grant) {*   // Line 2*
      if (!guard || guard(request.kauth.grant.access_token, request,
response)) {
        return next();
      }

      return keycloak.accessDenied(request, response, next);
    }
........

*When I am invoking protect.js in my GET request:-*

router.get('/', cors(), keycloak.protect(), function (req, res, next) { }

Line 2, which is the if statement is turning out to be false, so* I wanted
to know why is request.kauth and request.kauth.grant returning false?*


Thanks in advance
Saransh


More information about the keycloak-user mailing list