[keycloak-user] Example of npm keycloak-connect with bearer or JWT

Kevin Berendsen kevin.berendsen at pharmapartners.nl
Thu Apr 20 10:38:53 EDT 2017


Hi Austin,

The token stored in the session storage of the Node.js application is the JWT. If you program your application to output the stored token and parse it into the jwt.io website, you will be able to see the actual content of the token. This token is also used as bearer token. 

The only reason to use the token as bearer token is when you wish to get access of cross origin resources that are protected by your Keycloak instance. 

If you want to use your node.js application as your resource server, then configure the client in Keycloak to be a bearer-only client that accepts only bearer tokens in the HTTP Authorization header. 

Things to do:
• Go to your Keycloak instance and configure your Client’s Access Type to ‘bearer-only’;
• Generate a new Keycloak.json file (docs of this configuration file [1])
• Remove the session store from the Keycloak object initialization [2] 
And I believe that’s it.

[1] https://www.keycloak.org/docs/3.0/securing_apps/topics/oidc/java/java-adapter-config.html 
[2] https://www.keycloak.org/docs/3.0/securing_apps/topics/oidc/nodejs-adapter.html#_usage 

Kind regards,

Kevin

--------------------------------------
Van: Austin Cunningham [mailto:aucunnin at redhat.com] 
Verzonden: woensdag 19 april 2017 11:02
Aan: Kevin Berendsen <mailto:kevin.berendsen at pharmapartners.nl>
CC: mailto:keycloak-user at lists.jboss.org
Onderwerp: Re: [keycloak-user] Example of npm keycloak-connect with bearer or JWT

Hi Kevin, 
Thanks for getting back to me , I have reviewed that example before , it seems to be using sessions , not bearer or jwt. Correct me if I am wrong I could be missing something. I was hoping to find an implementation of http://blog.keycloak.org/2015/10/authentication-of-clients-with-signed.html.
Regards
Austin

On 19 April 2017 at 08:32, Kevin Berendsen <mailto:kevin.berendsen at pharmapartners.nl> wrote:
Hi Austin,

I believe this example is what you're looking for. [1]

Make sure you read the README carefully.

[1] https://github.com/keycloak/keycloak-nodejs-connect/tree/master/example

Kind regards,

Kevin

-----Oorspronkelijk bericht-----
Van: mailto:keycloak-user-bounces at lists.jboss.org [mailto:mailto:keycloak-user-bounces at lists.jboss.org] Namens Austin Cunningham
Verzonden: dinsdag 18 april 2017 16:54
Aan: mailto:keycloak-user at lists.jboss.org
Onderwerp: [keycloak-user] Example of npm keycloak-connect with bearer or JWT

Hi ,

I am looking for an example of JWT or Bearer implemented in Node.js with express js with Keycloak .

Regards,
Austin
_______________________________________________
keycloak-user mailing list
mailto:mailto:keycloak-user at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user

_______________________________________________
keycloak-user mailing list
mailto:keycloak-user at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user



-- 
AUSTIN CUNNINGHAM
SOFTWARE ENGINEERING INTERN 
https://www.redhat.com
Communications House, Cork Road, Waterford X91NY33
Ireland
mailto:aucunnin at redhat.com    
https://red.ht/sig





More information about the keycloak-user mailing list