We keep getting this error. Can anyone point us in the right direction?
Token endpoint error: {“error_description”:“JWT is not valid”,“error”:“invalid_client”}
Stack: at Cis2AuthService.ExchangeCodeForTokenObject(String code) in d:\HostingSpace\istaffrota_UATNew\App_Code\Cis2AuthService.cs:line 69 at VisionIntel.IStaffRota.WebApp.cis2.Cis2Callback.Page_Load(Object sender, EventArgs e) in d:\HostingSpace\istaffrota_UATNew\cis2\Cis2Callback.aspx.cs:line 59
Assuming you are calling the CIS2 Auth token endpoint we would need more details of the request to find the error log entry. However, this is generally caused by invalid config on your side.
The is likely due to the JWKS endpoint is not valid, not accessible or returning the invalid keys - it has to be discoverable and visible over the internet. Check for bad characters, commas, etc in your JWKS file, ensure the right KID is being used and that the key is valid
Thanks for that. Firstly and most importantly, you have included passwords and secrets in the linked file - please replace those in your code and delete the zip file.
Secondly the issue is that the JWKS file appears to be UTF-8 and has a BOM (Byte Order Marker) at the start which is not recognised (0xef, 0xbb,0xbf) , please upload a vanilla text file without the BOM.
The location doesn’t matter, it is the content - it will work as expected when the BOM is removed from the start of the file. The above is still incorrect (there are 3 hidden characters in the actual file)
the latest file sent does not seem to have a BOM in it, is it not the fact that if it start with 7B, then it does not have a bom. developers are out for the day, but saved this file as UTF-8… Would this work?
but we still get this error. where could we go wrong please?
CIS2 Authentication
Returned state: ……
CIS2 Authentication Error:
Token endpoint error: {“error_description”:“JWT is not valid”,“error”:“invalid_client”}
Stack: at Cis2AuthService.ExchangeCodeForTokenObject(String code) in d:\HostingSpace\istaffrota_UATNew\App_Code\Cis2AuthService.cs:line 69 at VisionIntel.IStaffRota.WebApp.cis2.Cis2Callback.Page_Load(Object sender, EventArgs e) in d:\HostingSpace\istaffrota_UATNew\cis2\Cis2Callback.aspx.cs:line 59
The signature is invalid given the above key - You can use https://JWT.io to test your assertion value using the your public key in the JWKS file. When I place the current key and your last assertion (as of 8:12 this morning) it fails validation. I’d suspect the key used to sign the token is different to the public key. Note if you change the key value you need to change the kid in line with any rotation - We will cache the key for a period of time and only will only fetch it if we don’t recognise the kid
everything seems valid we are getting the same error, at some point we got this error: Token endpoint error: {“error_description”:“Invalid JWT audience”,“error”:“invalid_client”}