Why do I receive errors like "Unauthorized" or "The login state is invalid" after upgrading MATLAB Web App Server to R2024b?

9 次查看(过去 30 天)

I have been using MATLAB Web App Server with OIDC authentication enabled. I recently updated from an earlier release to R2024b. However, I am now hitting errors when I attempt to log in, even though I'm using the exact same webapps_authn.json file that worked in a prior release.
After logging in, I'm redirected to a page with an error message like "Unauthorized" or "The login state is invalid."
The webapps_<timestamp> log shows errors like:

00008333 2025-02-27 17:17:56 0x000053e0 agent::processcontrol::out V processID=015efa51-14a9-43f6-bf63-3bcbbea35052, out={"level":"WARN","time":"2025-02-27T17:17:56.140-0500","caller":"authnzoidc/authnzoidc.go:364","message":"Error: oidcResponse verification of the id_token failed"}

00001010 2025-03-17 12:09:09 0x000022e0 agent::processcontrol::out V processID=68c4894c-c73b-414b-a0b4-38904ffaf297, out={"level":"WARN","time":"2025-03-17T12:09:09.877-0400","caller":"authnzoidc/authnzoidc.go:269","message":"Code login failure, msg state is invalid","msgState":"<nil>"}
Why am I now getting these errors?

采纳的回答

MathWorks Support Team
Starting in R2024b, there were some changes to the MATLAB Web App Server authentication service. The new implementation is slightly stricter about OIDC compliance, which may cause failures with identity providers that were working in previous versions.
The most common cause of this issue is due to a mismatch in the issuer MWAS expects to see on the token (based on the "issuer" in webapps_authn.json) and the actual issuer in the token that is returned by the identity provider. 
  • The expected issuer is found by removing the string "/.well-known/openid-configuration" from the value set as the "issuer" in the webapps_authn.json file.
  • The actual issuer can be found by entering the URL you are using as the issuer in the webapps_authn.json file into a browser -- which should send you to a JSON discovery document with information about the identity provider -- and checking the value listed as "issuer" there.
Ensure that these values match, or make changes to your webapps_authn.json file (or your identity provider configuration) to resolve any differences.
For example, if visiting the URL shows an issuer of:
https://sso.mydomain.com:443/auth/oauth
you will need to include this port in your webapps_authn.json file, like:
https://sso.mydomain.com:443/auth/oauth2/.well-known/openid-configuration
As another example, if the issuer listed at the discovery URL has a trailing '/' character:
https://mytenant.b2clogin.com/tfp/mytenant/mypolicy/v2.0/
then adjust the "issuer" in webapps_authn.json to account for the extra character:
https://mytenant.b2clogin.com/tfp/mytenant/mypolicy/v2.0//.well-known/openid-configuration

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Enterprise Deployment with MATLAB Production Server 的更多信息

标签

尚未输入任何标签。

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by