I am trying to access Sharepoint via API and download/upload files to a site
I created an application in Azure Portal. Created client secret. Gave delegated permissions to user.
I am using msal module. I am unable to get token when i m using username and password(Error: Authentication failed)
--Code
import msal
app = msal.ConfidentialClientApplication(client_id, client_credential=client_secret, authority='https://login.microsoftonline.com/{tenant}',validate_authority=True)
-- able to get access token with below. But since the application has only delegated access. This token will not be useful to authorize sharepoint
app.acquire_token_for_client(scopes=["https://{tenant}.sharepoint.com/.default"])
--authenticatication failed with below code
app.acquire_token_by_username_password(username, password, ["https://{tenant}.sharepoint.com/.default"])
Please help me