[keycloak-user] node adapter

Greet Robijns greetrobijns at gmail.com
Fri Mar 22 04:44:59 EDT 2019


Thanks! That is it.

Kind Regards,
Greet Robijns


Op vr 22 mrt. 2019 om 09:39 schreef Sebastien Blanc <sblanc at redhat.com>:

> I see a typo in your config : it's "serverUrl" not "url".
>
> On Fri, Mar 22, 2019 at 9:10 AM Greet Robijns <greetrobijns at 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/openid-connect/auth?c...
>> ..
>>
>> 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 at redhat.com>:
>>
>>>
>>>
>>> On Fri, Mar 15, 2019 at 2:33 PM Greet Robijns <greetrobijns at gmail.com>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I followed the instructions on
>>>>
>>>> https://www.keycloak.org/docs/latest/securing_apps/index.html#_nodejs_adapter
>>>> 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 at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>>>>
>>>


More information about the keycloak-user mailing list