Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

Couldn't complete authentication for new access token after changing localhost to keycloak in access token url #7

Open
GeorgeTan615 opened this issue Mar 31, 2023 · 5 comments

Comments

@GeorgeTan615
Copy link

GeorgeTan615 commented Mar 31, 2023

First of all, thanks for the great content! However as I was following through part 9 of dockerizing the application, I was not able to get a new access token even after changing localhost to keycloak in the access token url. I also made changes to my hosts file to point the keycloak hostname to the localhost IP address of 127.0.0.1. I also made sure to regenerate a new client secret.

I've also tried running the docker-compose.yml file in this GitHub repository just in case my own docker-compose file had issues, but the problem still persisted even after running Sai's docker-compose.yml file.

Do note that everything is fine when the applications were ran locally and not in the docker containers.

Any help would be appreciated!
image

@SaiUpadhyayula
Copy link
Owner

@GeorgeTan615 In Postman, you will see console at the bottom, check what is the error you are receiving while requesting the token

@GeorgeTan615
Copy link
Author

GeorgeTan615 commented Apr 1, 2023

@SaiUpadhyayula Here is the error that I've gotten. Thanks!
image
image
image
image

@SaiUpadhyayula
Copy link
Owner

@GeorgeTan615 Which keycloak version are you using ? If you are using 19+, then remove the /realm from the url, it's no longer needed.

@GeorgeTan615
Copy link
Author

@SaiUpadhyayula Judging from the docker-compose.yml file, I believe its version 18.
image

@GeorgeTan615
Copy link
Author

@SaiUpadhyayula A little update on my situation. I'm able to get the access token now, turns out for some reason, my dockerized api gateway does not start on the port that I've specified and it always runs on port 8080, so after changing the issuer uri and token url to 8080, I'm able to get the access token. However upon sending the request in Postman, I would get iss claim not valid, but I did change localhost to keycloak and modified my hosts file.

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