-
MSAL client typePublic Problem StatementWe have written a python package (wtwco-igloo on PyPi) that allows our users to use Python to connect to their Igloo Cloud environment that is secured with Entra Id. One form of authentication that we support uses the device code flow to allow the user to interactively supply their user credentials to log in to the Enterprise Application as themselves. The frustrating thing is that this msal package is really close to allowing this feature to work, however there is a check in decode_id_token() that checks that the audience claim in the token retrieved from Entra Id is equal to the client_id passed in to the PublicClientApplication. However this won't be the case when the Application URI is used as the Client Id of the Enterprise Application is returned in the token. See below for a simple example that I would like to work but which raises the error: It might be that you consider this issue to be more of a bug than a feature request, I wasn't too sure. Proposed solutionI would like the following code to work (you will obviously need to use a different application_uri to match an Enterprise Application that you have access to) import requests application_uri = "https://devcon1.cloud.igloo.wtwsaas.dev" http_client = requests.Session() flow = msal_client.initiate_device_flow(scopes=[scope]) |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
By design, an app's client_id is its canonical identifier. The Application URI, on the contrary, might not even be established, or likely has a shape as Not sure how your downstream developer got their application uri While we may evaluate this feature request in the future, the suggestion for you is to stick with client_id whenever possible. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the quick response. In our case the Application URI is set up when we deploy the Igloo Cloud environment and is deliberately set to the domain name of the URL hosting the environment. This is very useful as it allows our Clients to connect to the Igloo Cloud OData feed using Excel and Power BI without the need for any additional information except for the OData feed URL itself. As an aside, when I removed the lines:
from oidc.py the device code flow completed successfully and I can connect to the Igloo Cloud API. |
Beta Was this translation helpful? Give feedback.
-
I gave it more thought, but still not quite sure that this client-side SDK (MSAL) shall remove that check broadly. Quoting from the OIDC specs, section 3.1.3.7. ID Token Validation:
I can understand your scenario, @BertieWTW . Perhaps you may consider the following two alternatives.
|
Beta Was this translation helpful? Give feedback.
-
Many thanks for your help with this issue. My thinking was that there was no particular need for this part of the msal library to validate the claims as the purpose of this call is simply to retrieve the bearer token which the python application will pass on the relevant web service which will need to validate the bearer token before servicing any API calls. However I am by no means an expert in this area, so would definitely expect you to seek advice before making any changes !
|
Beta Was this translation helpful? Give feedback.
-
That part is debatable. There are two layers here.
Your scenario may need For the sake of completeness, this MSAL Python library does contain an OAuth2-only component, which can be used to obtain an access token without any ID token validation, but it is NOT part of MSAL Python's official API so it might be changed without prior notice. Besides, using such a low-level building block would also mean that you won't have MSAL's token cache benefit. So, realistically speaking, I still think your best bet is the two options that I mentioned in my previous message. |
Beta Was this translation helpful? Give feedback.
-
Understood, thanks for the detailed explanation.
|
Beta Was this translation helpful? Give feedback.
I gave it more thought, but still not quite sure that this client-side SDK (MSAL) shall remove that check broadly. Quoting from the OIDC specs, section 3.1.3.7. ID Token Validation:
I can understand your scenario, …