|
| 1 | +--- |
| 2 | +title: How to configure Postman for Azure Digital Twins | Microsoft Docs |
| 3 | +description: How to configure Postman for Azure Digital Twins |
| 4 | +author: kingdomofends |
| 5 | +manager: alinast |
| 6 | +ms.service: digital-twins |
| 7 | +services: digital-twins |
| 8 | +ms.topic: conceptual |
| 9 | +ms.date: 11/13/2018 |
| 10 | +ms.author: adgera |
| 11 | +--- |
| 12 | + |
| 13 | +# How to configure Postman for Azure Digital Twins |
| 14 | + |
| 15 | +This article describes how to configure an Azure Active Directory (Azure AD) application to use the OAuth 2.0 implicit grant flow. Then, it discusses how to configure the Postman REST client to make token-bearing HTTP requests to your Management APIs. |
| 16 | + |
| 17 | +## Postman summary |
| 18 | + |
| 19 | +Get started on Azure Digital Twins by using a REST client tool such as [Postman](https://www.getpostman.com/) to prepare your local testing environment. The Postman client helps to quickly create complex HTTP requests. Download the desktop version of the Postman client by going to [www.getpostman.com/apps](https://www.getpostman.com/apps). |
| 20 | + |
| 21 | +[Postman](https://www.getpostman.com/) is a REST testing tool that locates key HTTP request functionalities into a useful desktop and plugin-based GUI. Through the Postman client, solutions developers can specify the kind of HTTP request (POST, GET, UPDATE, PATCH, and DELETE), API endpoint to call, and use of SSL. Postman also supports adding HTTP request headers, parameters, form-data, and bodies. |
| 22 | + |
| 23 | +## Configure Azure Active Directory to use the OAuth 2.0 implicit grant flow |
| 24 | + |
| 25 | +Configure your Azure AD app to use the OAuth 2.0 implicit grant flow. |
| 26 | + |
| 27 | +1. Follow the steps in [this quickstart](https://docs.microsoft.com/azure/active-directory/develop/quickstart-v1-integrate-apps-with-azure-ad) to create an Azure AD application of type Native. Or you can reuse an existing Native app registration. |
| 28 | + |
| 29 | +1. Under **Required permissions**, enter `Azure Digital Twins` and select **Delegated Permissions**. Then select **Grant Permissions**. |
| 30 | + |
| 31 | +  |
| 32 | + |
| 33 | +1. Click **Manifest** to open the application manifest for your app. Set *oauth2AllowImplicitFlow* to `true`. |
| 34 | + |
| 35 | + ![Azure AD implicit flow][1] |
| 36 | + |
| 37 | +1. Configure a **Reply URL** to [`https://www.getpostman.com/oauth2/callback`](https://www.getpostman.com/oauth2/callback). |
| 38 | + |
| 39 | + ![Azure AD Reply URL][2] |
| 40 | + |
| 41 | +1. Copy and keep the **Application ID** of your Azure AD app. It is used below. |
| 42 | + |
| 43 | +## Configure the Postman client |
| 44 | + |
| 45 | +Next, set up and configure Postman to obtain an Azure AD token. Afterwards, make an authenticated HTTP request to Azure Digital Twins using the acquired token: |
| 46 | + |
| 47 | +1. Go to [www.getpostman.com]([https://www.getpostman.com/) to download the app. |
| 48 | +1. Ensure that your **Authorization URL** is correct. It should take the format: |
| 49 | + |
| 50 | + ```plaintext |
| 51 | + https://login.microsoftonline.com/YOUR_AZURE_TENANT.onmicrosoft.com/oauth2/authorize?resource=YOUR_RESOURCE_ID |
| 52 | + ``` |
| 53 | +
|
| 54 | + | Name | Replace with | Example | |
| 55 | + |---------|---------|---------| |
| 56 | + | YOUR_AZURE_TENANT | The name of your tenant or organization | `microsoft` | |
| 57 | + | YOUR_RESOURCE_ID | The resource ID | `10b07f429-9f4b-4714-9392-cc5e8e80c8b0` | |
| 58 | +
|
| 59 | +1. Select the **Authorization** tab, select **OAuth 2.0**, and then select **Get New Access Token**. |
| 60 | +
|
| 61 | + | Field | Value | |
| 62 | + |---------|---------| |
| 63 | + | Grant Type | `Implicit` | |
| 64 | + | Callback URL | [`https://www.getpostman.com/oauth2/callback`](https://www.getpostman.com/oauth2/callback) | |
| 65 | + | Auth URL | Use the **Authorization URL** from step 2 above | |
| 66 | + | Client ID | Use the **Application ID** for the Azure AD app that was created or repurposed from the previous section | |
| 67 | + | Scope | leave blank | |
| 68 | + | State | leave blank | |
| 69 | + | Client Authentication | `Send as Basic Auth header` | |
| 70 | +
|
| 71 | +1. The client should now look like: |
| 72 | +
|
| 73 | + ![Postman client example][3] |
| 74 | +
|
| 75 | +1. Select **Request Token**. |
| 76 | +
|
| 77 | + >[!NOTE] |
| 78 | + >If you receive the error message "OAuth 2 couldn’t be completed," try the following: |
| 79 | + > * Close Postman, and reopen it and try again. |
| 80 | + |
| 81 | +1. Scroll down, and select **Use Token**. |
| 82 | +
|
| 83 | +## Next steps |
| 84 | +
|
| 85 | +To learn about authenticating with the Management APIs, read [Authenticate with APIs](./security-authenticating-apis.md). |
| 86 | +
|
| 87 | +<!-- Images --> |
| 88 | +[1]: media/how-to-configure-postman/implicit-flow.png |
| 89 | +[2]: media/how-to-configure-postman/reply-url.png |
| 90 | +[3]: media/how-to-configure-postman/postman-oauth-token.png |
0 commit comments