I cannot seem to figure out how to acquire an access token using MSAL. I’ve spend time reading the source code and Microsoft documentation to no avail. I’d like to use the PublicClientApplication to acquire the token. Even when running proof of concepts with the QuickStarts using ConfidentialClientApplication I seem to only get an ID_Token not an access token. Ultimately I’m trying to build a desktop/mobile app and want to be able to use MSAL for id token claims and access tokens for access to APIs. Also worth mentioning I want to implement this using AAD B2C Thanks!
I have reproduced in my environment and got expected results as below and followed Microsoft-Document:
from msal import ConfidentialClientApplication
cid = "53f3ed37d4aeac"
csecret = "AFK8MY-weud6cqP7jsvAJIojaq-"
tid = "72f981db47"
auth = f"https://login.microsoftonline.com/{tid}"
app = ConfidentialClientApplication(
client_id=cid,
client_credential=csecret,
authority=auth
)
s = "https://graph.microsoft.com/.default"
result = app.acquire_token_for_client(scopes=s)
a = result.get("access_token")
print(a)
Output:

Here csecret is client secret
cid is client id
tid is tenant id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With