项目作者: luyandamncube

项目描述 :
Dump repo for Python console app (Microsoft ADAL Authentication)
高级语言: Python
项目地址: git://github.com/luyandamncube/Pyth_Auth.git
创建时间: 2019-11-07T14:01:59Z
项目社区:https://github.com/luyandamncube/Pyth_Auth

开源协议:

下载


Pyth_Auth

Demo for python console app (browserless) using MSAL Authentication. Based on Python sample for Microsoft Graph.

Pre-requisites

Installation

  1. Install prerequisite python packages:
    pip install -r requirements.txt

  2. Register an application in Azure portal.

  • Select API permissions Users.Read.All and Users.Readbasic.All.
  1. Edit Authentication settings.
  • Go to Authentication. Check the box next to https://login.microsoftonline.com/common/oauth2/nativeclient
  • Find Default client type and set it to yes
  1. Modify config.py
  • Replace 'ENTER_YOUR_CLIENT_ID' with your Application (client) ID
  • Replace 'ENTER_YOUR_EMAIL_ADDRESS' with your Office 365 email address
  • Replace 'ENTER_YOUR_PASSWORD' with your Office 365 password

Running the sample

  1. Run the command python sample.py in your terminal
  2. Enter the email address of the person you want to search for in your organisation
  3. A Microsoft Graph query will be excecute to return a json object of a manager’s email.

e.g.

Troubleshooting

If you are seeing the Authorization_RequestDenied: Insufficient privelleges to complete the operation. error, contact your administrator and request admin consent for Users.Read.All and Users.Readbasic.All permissions.

In your azure portal, under Home > App Registraions > API Permissions, the permissions should look as follows: