Skip to content
This repository was archived by the owner on Mar 7, 2020. It is now read-only.

Commit 7abff84

Browse files
committed
Updated app registration instructions
1 parent c0e7dcc commit 7abff84

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,29 @@ Follow these steps to install the sample code on your computer:
3535

3636
To run the sample, you will need to register an application and add the registered application's ID to the configuration information in the [config.py](https://github.com/microsoftgraph/python-sample-console-app/blob/master/helpers.py) file. Follow these steps to register and configure your application:
3737

38-
1. Sign in to the [Azure Portal](https://portal.azure.com) and choose **Azure Active Directory** in the sidebar, then choose **App registrations** and **New application registration**.
38+
1. Navigate to the [Azure portal > App registrations](https://go.microsoft.com/fwlink/?linkid=2083908) to register your app. Sign in using a work or school account, or a personal Microsoft account.
3939

40-
2. Enter a unique name for your application, choose **Native** for the Application type, and enter any valid URL for **Redirect URI**. (The Redirect URI is not used in this sample, but you must enter a valid URL during app registration.) Then choose **Create**.
41-
![create application](images/registration1.png)
40+
2. Select **New registration**.
4241

43-
3. After the application is created, you'll be returned to the **App registrations** list. Choose your app from the list to open the settings page. Once you have the app settings page open, copy the **Application ID** and save it. You'll need this later to complete the setup process.
44-
![copy Application ID](images/registration2.png)
42+
3. When the **Register an application page** appears, set the values as follows:
43+
1. Set **Name** to `PythonConsoleApp`.
44+
2. Set **Supported account types** to **Accounts in any organizational directory and personal Microsoft accounts**.
45+
3. Leave **Redirect URI** empty.
46+
4. Choose **Register**.
4547

46-
4. The final step in app registration is to add the permissions that the sample app requires. From the app settings page, choose **Required permissions**, then **Add**, then **Select an API**. Then choose **Microsoft Graph** and **Select**. Here you'll see a list of _Delegated Permissions_. Check the box next to these permissions:
47-
* **Have full access to user files** (this is the _Files.ReadWrite_ permission needed to upload files to your OneDrive account)
48-
* **Send email as a user** (this is the _Mail.Send_ permission needed to send email)
48+
4. On the **PythonConsoleApp** overview page, copy and save the value for the **Application (client) ID**. You'll need it later.
49+
50+
5. Select **API permissions**.
51+
1. Choose the **Add a permission** button and then make sure that the **Microsoft APIs** tab is selected.
52+
2. In the **Commonly used Microsoft APIs** section, select **Microsoft Graph**, and then select **Delegated permissions**.
53+
3. Use the **Select permissions** search box to search for the `Files.ReadWrite` and `Mail.Send` permissions.
54+
4. Select the checkbox for each permission as it appears.
55+
> **NOTE:** Permissions will not remain visible in the list as you select each one.
56+
57+
6. Go to the **Authentication** page.
58+
1. Check the box next to `https://login.microsoftonline.com/common/oauth2/nativeclient`.
59+
2. Find the setting labeled **Default client type** and set it to `Yes`.
60+
3. Select **Save** at the top of the page.
4961

5062
After registering your application, modify the ```config.py``` file in the root folder of your cloned repo, and follow the instructions to enter your Client ID (the Application ID value you copied in Step 3 earlier). Save the change, and you're ready to run the sample.
5163

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pyperclip>=1.6.0
22
requests>=2.18.4
3-
adal>=0.4.7
3+
adal>=0.4.7

sample.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def sendmail_sample(session):
2727

2828
print('\nGet user profile ---------> https://graph.microsoft.com/beta/me')
2929
user_profile = session.get(api_endpoint('me'))
30-
print(28*' ' + f'<Response [{user_profile.status_code}]>',
31-
f'bytes returned: {len(user_profile.text)}\n')
30+
print(28*' ' + f'<Response [{user_profile.status_code}]>', f'bytes returned: {len(user_profile.text)}\n')
3231
if not user_profile.ok:
3332
pprint.pprint(user_profile.json()) # display error
3433
return

0 commit comments

Comments
 (0)