Azure-Samples / active-directory-verifiable-credentials-python

A code sample demonstrating how to use Entra Verified ID's functionality to issue and consume verifiable credentials in python.
MIT License
15 stars 14 forks source link

The scope specified in the msal's acquire_token_for_client method is not in list format. #26

Closed iamkdada closed 5 months ago

iamkdada commented 11 months ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Execute the instructions in the README.md file up to the "Running the sample" section.

Any log messages given by the failure

Traceback (most recent call last): File "app.py", line 96, in result = msalCca.acquire_token_for_client( scopes="3db474b9-6a0c-4840-96ac-1fceb342124f/.default" ) File "/mnt/c/Users/keisukewada/source/kdada-vc/active-directory-verifiable-credentials-python/1-python-api-idtokenhint/venv/lib/python3.8/site-packages/msal/application.py", line 2146, in acquire_token_for_client return _clean_up(self._acquire_token_silent_with_error( File "/mnt/c/Users/keisukewada/source/kdada-vc/active-directory-verifiable-credentials-python/1-python-api-idtokenhint/venv/lib/python3.8/site-packages/msal/application.py", line 1282, in _acquire_token_silent_with_error assert isinstance(scopes, list), "Invalid parameter type" AssertionError: Invalid parameter type

Expected/desired behavior

It's unclear if past versions of MSAL allowed passing scopes as a string, but at least in my environment (msal: 1.26.0), scopes must now be passed in list format, otherwise an AssertionError occurs. Therefore, I believe it's necessary to pass "3db474b9-6a0c-4840-96ac-1fceb342124f/.default" as a list.

-result = msalCca.acquire_token_for_client( scopes="3db474b9-6a0c-4840-96ac-1fceb342124f/.default" ) 
+result = msalCca.acquire_token_for_client( scopes=["3db474b9-6a0c-4840-96ac-1fceb342124f/.default"] )  

OS and Version?

Windows 11 WSL Ubuntu 20.04.6 LTS

Versions

Mention any other details that might be useful


As an additional note, the specification of scopes="3db474b9-6a0c-4840-96ac-1fceb342124f/.default" can be found in four files: README.md, app.py, issuer.py, and verifier.py.

cljung commented 5 months ago

@iamkdada - you're absolutely correct and thank you for reporting. Bug fixed. Sorry it took a while