I'm adpting a basic script, that i did to send standardized emails to a list of emails, to use msal.
I used the msal python lib (v 1.21.0) like so:
import msal
redirect_url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize/"
tokens_dir = r"<PATH>"
token_filename = r"<TOKEN_FILENAME>"
scopes = ["Mail.Send","Mail.ReadWrite","User.Read"]
authority = f"https://login.microsoftonline.com/{tenant_id}/"
app = msal.ConfidentialClientApplication(client_id=client_id, client_credential=client_secret, authority=authority)
url = app.get_authorization_request_url(scopes=scopes, redirect_uri=redirect_url)
code = input("Token auth code:" )
app.acquire_token_by_authorization_code(code, scopes=scopes, redirect_uri=redirect_url)
For testing pourposes it's written on a ipython notebook. So I access the url given by the "get_authorization_request_url" method that was supposed to give me the authorization code.
But I'm getting this error AADSTS900144: The request body must contain the following parameter: 'client_id'
. I found this post talking about this, but I don't know how to include the parameter on the body instead of the query.