From 46748914e30718d6f122fa1949ca70a447dc7cee Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Fri, 12 Jul 2019 09:38:44 +0200 Subject: [PATCH] changing 2 and 3 --- 2. Web API now calls Microsoft Graph/README.md | 2 +- .../TodoListClient/MainWindow.xaml.cs | 4 +++- .../README.md | 2 +- .../TodoListClient/MainWindow.xaml.cs | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/2. Web API now calls Microsoft Graph/README.md b/2. Web API now calls Microsoft Graph/README.md index 3138850..6ec0049 100644 --- a/2. Web API now calls Microsoft Graph/README.md +++ b/2. Web API now calls Microsoft Graph/README.md @@ -186,7 +186,7 @@ If you want to register your apps manually, as a first step you'll need to: - Select **Register** to create the application. 1. On the app **Overview** page, find the **Application (client) ID** value and record it for later. You'll need it to configure the Visual Studio configuration file for this project (`ida:ClientId` in `TodoListClient\App.Config`). 1. From the app's Overview page, select the **Authentication** section. - 1. In the **Redirect URIs** list, select for **TYPE** Public client (mobile & desktop). Then paste this value **urn:ietf:wg:oauth:2.0:oob** in the **REDIRECT URI** column. + 1. In the **Redirect URIs** list, under **Suggested Redirect URIs for public clients (mobile, desktop)** check the box next to **https://login.microsoftonline.com/common/oauth2/nativeclient**. 1. Select **Save**. 1. Select the **API permissions** section - Click the **Add a permission** button and then, diff --git a/2. Web API now calls Microsoft Graph/TodoListClient/MainWindow.xaml.cs b/2. Web API now calls Microsoft Graph/TodoListClient/MainWindow.xaml.cs index 4b19320..56cdb5b 100644 --- a/2. Web API now calls Microsoft Graph/TodoListClient/MainWindow.xaml.cs +++ b/2. Web API now calls Microsoft Graph/TodoListClient/MainWindow.xaml.cs @@ -79,6 +79,7 @@ public MainWindow() InitializeComponent(); _app = PublicClientApplicationBuilder.Create(ClientId) .WithAuthority(Authority) + .WithDefaultRedirectUri() .Build(); TokenCacheHelper.EnableSerialization(_app.UserTokenCache); @@ -221,7 +222,8 @@ await _app.AcquireTokenInteractive(scopes) else if (proposedAction == "consent") { IPublicClientApplication pca = PublicClientApplicationBuilder.Create(clientId) - .Build(); + .WithDefaultRedirectUri() + .Build(); await pca.AcquireTokenInteractive(scopes) .WithPrompt(Prompt.Consent) .WithLoginHint(loginHint) diff --git a/3.-Web-api-call-Microsoft-graph-for-personal-accounts/README.md b/3.-Web-api-call-Microsoft-graph-for-personal-accounts/README.md index ba6dec4..f7866e3 100644 --- a/3.-Web-api-call-Microsoft-graph-for-personal-accounts/README.md +++ b/3.-Web-api-call-Microsoft-graph-for-personal-accounts/README.md @@ -172,7 +172,7 @@ What **differs from the previous chapter** is that you will use the same applica 1. On the app **Overview** page, find the **Application (client) ID** value and record it for later. You'll need it to configure the Visual Studio configuration file for this project (`ida:ClientId` in `TodoListClient\App.Config`). 1. From the app's Overview page, select the **Authentication** section. - - In the **Redirect URLs** | Add the following redirect URI: **urn:ietf:wg:oauth:2.0:oob** + - In the **Redirect URIs** list, under **Suggested Redirect URIs for public clients (mobile, desktop)** check the box next to **https://login.microsoftonline.com/common/oauth2/nativeclient**. - Select **Save**. ### Step 3: Configure the sample to use your Azure AD tenant diff --git a/3.-Web-api-call-Microsoft-graph-for-personal-accounts/TodoListClient/MainWindow.xaml.cs b/3.-Web-api-call-Microsoft-graph-for-personal-accounts/TodoListClient/MainWindow.xaml.cs index 300cb7a..2da3ee7 100644 --- a/3.-Web-api-call-Microsoft-graph-for-personal-accounts/TodoListClient/MainWindow.xaml.cs +++ b/3.-Web-api-call-Microsoft-graph-for-personal-accounts/TodoListClient/MainWindow.xaml.cs @@ -79,6 +79,7 @@ public MainWindow() InitializeComponent(); _app = PublicClientApplicationBuilder.Create(ClientId) .WithAuthority(Authority) + .WithDefaultRedirectUri() .Build(); TokenCacheHelper.EnableSerialization(_app.UserTokenCache); @@ -221,6 +222,7 @@ await _app.AcquireTokenInteractive(scopes) else if (proposedAction == "consent") { IPublicClientApplication pca = PublicClientApplicationBuilder.Create(clientId) + .WithDefaultRedirectUri() .Build(); await pca.AcquireTokenInteractive(scopes) .WithPrompt(Prompt.Consent)