I see a typo in your config : it's "serverUrl" not "url".
On Fri, Mar 22, 2019 at 9:10 AM Greet Robijns <greetrobijns(a)gmail.com>
wrote:
Hi
Thank you for the reply.
Request from frontend to backend are handled by Graphql (apollo)
I have removed
"bearer-only": true
from my keycloak configuration and now it is redirecting to
http://localhost:4000/undefined/realms/Marketing%20Console/protocol/openi....
..
which is definitly a step forward!
If i replace the undefined with "auth" manually in the url my login page
comes up and login "works" it redirects again to .../undefined/... of course
I have not done anything yet with the token.
Kind Regards
Greet Robijns
Op do 21 mrt. 2019 om 18:31 schreef Sebastien Blanc <sblanc(a)redhat.com>:
>
>
> On Fri, Mar 15, 2019 at 2:33 PM Greet Robijns <greetrobijns(a)gmail.com>
> wrote:
>
>> Hi all,
>>
>> I followed the instructions on
>>
>>
https://www.keycloak.org/docs/latest/securing_apps/index.html#_nodejs_ada...
>> to add a keycloak to my express server.
>>
>> my routes are handled by react on the client side.
>>
>> However I only get "access denied" and no redirection to the
>> authentication
>> page?
>>
> No redirect is correct since you flagged your nodejs app with
> "bearer-only".
> How does the frontend send the request to the backend ? Are you using the
> javascript adapter to obtain the token ?
>
>>
>> My configuration:
>>
>> var session = require("express-session");
>> var Keycloak = require("keycloak-connect");
>> connectWithRetry();
>> var memoryStore = new session.MemoryStore();
>> let kcConfig = {
>> realm: "Marketing Console",
>> url: "http://localhost:8080/auth",
>> clientId: "marketing_console",
>> "bearer-only": true,
>> "ssl-required": "none",
>> "enable-cors": true,
>> "public-client": true
>> };
>>
>> app.use(
>> session({
>> secret: "mySecret",
>> resave: false,
>> saveUninitialized: true,
>> store: memoryStore
>> })
>> );
>>
>> let keycloak = new Keycloak({ store: memoryStore }, kcConfig);
>>
>> app.get("/", keycloak.protect());
>>
>>
>> Kind Regards
>> Greet Robijns
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/keycloak-user
>>
>