Authentication Microsoft error AADSTS50076 python code

Copper Contributor

Hi,

 

I am working on an app involving authentication to Microsoft Teams. The app will be used for updating data in files that are shared to SharePoint/Microsoft Teams. My code is currently built on the office365 Python library and keyring for using encrypted login credentials when running the code under development.

 

To log in to SharePoint I am using my Outlook 365 account. My company also uses 2FA to sign in (Microsoft Authenticator), and I have approved access to the folder.

When running the code I get the following error:

"An error occurred while retrieving token from XML response: AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access"

I am suspecting that I do not have the right admin/access rights. If that is the case, however, then it would be a hassle for my teammates to use the app if everyone has to start off with requesting admin rights. The ideal case would therefore be if there is was way to bypass this issue by coding.

I should also mention that I have tried to use PowerShell and app creation in order to access SharePoint. This method didn't work as I wasn't authorized to perform the action of storage creation - adding to the probability that the problem arises from not having the required admin rights. But as previously said, if possible I would prefer not having to ask for admin rights.

Does anyone know how to move forward with this issue?

1 Reply
this might help you. Other product, same issue. It is in fact MFA hindering the authentication.
For me a default user was sufficient. In your case I'd consult the documentation and assign least elevated permissions.
Good luck.

https://techcommunity.microsoft.com/t5/windows-admin-center-blog/windows-admin-center-version-2306-i...