cognito-local
cognito-local copied to clipboard
Unable to use access tokens due to issuer url mismatch
I have an application trying to use this image currently I have some tests failing because the issuer url does not match due to the application being spun up on a dynamic port using test containers, so my application has an issuer url of: http://localhost:62847/local_2D4gvA2k but the token is being generated using: http://localhost:9229/local_2D4gvA2k due to the hostname and port being hardcoded here which is causing my authentication attempt to fail.
I also noticed a similar issue here too.
I have attempted to fix in this PR. I am not overly happy with the duplication in the fix, so it could be cleaner, but I think it might do the job in the short term?!
My current work around is to have my automated tests start the cognito container fixed to port 9229, but it would be better and more robust to be able to spin it up on any free port.
FWIW, you can set the TokenConfig.IssuerDomain option in your config file to change the issuer URL. It's annoying that you need to do that if you change the port, but it should work.