|
| 1 | +# How to run the completed project |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +To run the completed project in this folder, you need the following: |
| 6 | + |
| 7 | +- [Java SE Development Kit (JDK)](https://java.com/en/download/faq/develop.xml) and [Maven](https://maven.apache.org/) installed on your development machine. If you do not have the JDK or Maven, visit the previous links for download options. (**Note:** This tutorial was written with OpenJDK version 12.0.1 and Maven 3.6.1. The steps in this guide may work with other versions, but that has not been tested.) |
| 8 | +- A Microsoft work or school account. |
| 9 | + |
| 10 | +If you don't have a Microsoft account, you can [sign up for the Office 365 Developer Program](https://developer.microsoft.com/office/dev-program) to get a free Office 365 subscription. |
| 11 | + |
| 12 | +## Register a web application with the Azure Active Directory admin center |
| 13 | + |
| 14 | +1. Open a browser and navigate to the [Azure Active Directory admin center](https://aad.portal.azure.com). Login using a **personal account** (aka: Microsoft Account) or **Work or School Account**. |
| 15 | + |
| 16 | +1. Select **Azure Active Directory** in the left-hand navigation, then select **App registrations** under **Manage**. |
| 17 | + |
| 18 | +  |
| 19 | + |
| 20 | +1. Select **New registration**. On the **Register an application** page, set the values as follows. |
| 21 | + |
| 22 | + - Set **Name** to `Java Graph Tutorial`. |
| 23 | + - Set **Supported account types** to **Accounts in any organizational directory**. |
| 24 | + - Leave **Redirect URI** empty. |
| 25 | + |
| 26 | +  |
| 27 | + |
| 28 | +1. Choose **Register**. On the **Java Graph Tutorial** page, copy the value of the **Application (client) ID** and save it, you will need it in the next step. |
| 29 | + |
| 30 | +  |
| 31 | + |
| 32 | +1. Select the **Add a Redirect URI** link. On the **Redirect URIs** page, locate the **Suggested Redirect URIs for public clients (mobile, desktop)** section. Select the `https://login.microsoftonline.com/common/oauth2/nativeclient` URI. |
| 33 | + |
| 34 | +  |
| 35 | + |
| 36 | +1. Locate the **Default client type** section and change the **Treat application as a public client** toggle to **Yes**, then choose **Save**. |
| 37 | + |
| 38 | +  |
| 39 | + |
| 40 | +## Configure the sample |
| 41 | + |
| 42 | +1. Rename the `oAuth.properties.example` file to `oAuth.properties`. |
| 43 | +1. Edit the `oAuth.properties` file and make the following changes. |
| 44 | + 1. Replace `YOUR_APP_ID_HERE` with the **Application Id** you got from the App Registration Portal. |
| 45 | + |
| 46 | +## Build and run the sample |
| 47 | + |
| 48 | +In your command-line interface (CLI), navigate to the project directory and run the following commands. |
| 49 | + |
| 50 | +```Shell |
| 51 | +mvn package |
| 52 | +java -cp target/graphtutorial-1.0-SNAPSHOT.jar com.contoso.App |
| 53 | +``` |
0 commit comments