Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

downgrade fixes issues with keycloak token verification #15

Open
SchuhMichael opened this issue Oct 9, 2020 · 5 comments
Open

downgrade fixes issues with keycloak token verification #15

SchuhMichael opened this issue Oct 9, 2020 · 5 comments

Comments

@SchuhMichael
Copy link

I have followed the advice in one of the answer to this question:
https://stackoverflow.com/questions/63111877/keycloak-with-angular-and-spring-error-get-http-localhost8180-auth-realms-st

to solve this:
GET http://localhost:8180/auth/realms/Storage/protocol/openid-connect/3p-cookies/step1.html 404 (Not Found)

After downgrading to version 10.0.2 for keycloak-js package, things work with keycloak.

@anne-pc
Copy link
Collaborator

anne-pc commented Oct 9, 2020

I've followed the linked discussion to this "A best practice is to load the JavaScript adapter directly from Keycloak Server as it will automatically be updated when you upgrade the server. " - https://www.keycloak.org/docs/latest/securing_apps/#_javascript_adapter

@anne-pc
Copy link
Collaborator

anne-pc commented Oct 9, 2020

Unfortunately I wasn't succesful at reproducing your fix with `"keycloak-js": "10.0.2", still behaves the same on my side.

@SchuhMichael
Copy link
Author

The keycloak server in my installation runs with version 10.0.2, appearantly that is the reason, why I had to downgrade the package. You have version 11.0.2 in package.json, which does not look like it is downloading the JavaScript adapter directly from Keycloak Server.

@anne-pc
Copy link
Collaborator

anne-pc commented Oct 13, 2020

I have indeed tried it by replacing keycloak's version in package.json... I will probably change the code to load keycloak from the server in the future as it is listed as best pratice although a bit of an anti-pattern in react.
However, I'm not really convinced that this is a bug rather than a feature. It would make senseto me that the token's issuer must match in order to validate the token.

@anne-pc
Copy link
Collaborator

anne-pc commented Dec 15, 2020

While the long term solution is to drop the keycloak adapter for a generic oidc client, the current issue lies indeed with keycloak and the way it determines the token issuer. I've done some investigation: pointed two different hostnames in my /etc/hosts to the server running keycloak eg.: keycloak / cloakkey. I have then pulled .well-known through those two hostnames and indeed one is returning "issuer":"http://keycloak:8080/auth/realms/master" and other "issuer":"http://cloakkey:8080/auth/realms/master". This is in my belief the cause of this problem.

@anne-pc anne-pc closed this as completed Dec 15, 2020
@anne-pc anne-pc reopened this Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants