Skip to content

Commit a737a83

Browse files
authored
Update migration fix message (#1062)
1 parent 44cb649 commit a737a83

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/Microsoft.Identity.Client/MigrationAid/MigrationAid.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,7 @@ public ClientCredential(string secret)
21022102
/// <summary>
21032103
///
21042104
/// </summary>
2105-
[Obsolete("In MSAL.NET 3.x, you should directly pass the Activity (on Xamarin.Android), or Window (on .NET Framework and UWP) as second parameter of AcquireTokenInteractive()" + MsalErrorMessage.AkaMsmsalnet3BreakingChanges, true)]
2105+
[Obsolete("In MSAL.NET 3.x, you should directly pass the Activity (on Xamarin.Android), or Window (on .NET Framework and UWP) using AcquireTokenInteractiveParameterBuilder.WithParentActivityOrWindow" + MsalErrorMessage.AkaMsmsalnet3BreakingChanges, true)]
21062106
public sealed class UIParent
21072107
{
21082108
/// <summary>

tests/devapps/UWP/MainPage.xaml.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ public sealed partial class MainPage : Page
2222
private readonly IPublicClientApplication _pca;
2323
private static readonly string s_clientID = "9058d700-ccd7-4dd4-a029-aec31995add0";
2424
private static readonly string s_authority = "https://login.microsoftonline.com/common/";
25-
private static readonly IEnumerable<string> s_scopes = new[] { "https://graph.windows.net/.default" };
26-
private const string Resource = "https://graph.windows.net";
27-
25+
private static readonly IEnumerable<string> s_scopes = new[] { "user.read" };
26+
private const string CacheFileName = "msal_user_cache.json";
2827

2928
public MainPage()
3029
{
@@ -39,7 +38,7 @@ public MainPage()
3938
if (tokenCacheNotifcation.HasStateChanged)
4039
{
4140
StorageFile cacheFile = ApplicationData.Current.LocalFolder.CreateFileAsync(
42-
"msal_user_cache.bin",
41+
CacheFileName,
4342
CreationCollisionOption.ReplaceExisting).AsTask().GetAwaiter().GetResult();
4443

4544
byte[] blob = tokenCacheNotifcation.TokenCache.SerializeMsalV3();
@@ -51,7 +50,7 @@ public MainPage()
5150

5251
_pca.UserTokenCache.SetBeforeAccess((tokenCacheNotifcation) =>
5352
{
54-
IStorageFile cacheFile = (ApplicationData.Current.LocalFolder.TryGetItemAsync("msal_user_cache.bin")
53+
IStorageFile cacheFile = (ApplicationData.Current.LocalFolder.TryGetItemAsync(CacheFileName)
5554
.AsTask().ConfigureAwait(false).GetAwaiter().GetResult()) as IStorageFile;
5655

5756
if (cacheFile != null)
@@ -145,7 +144,9 @@ private async void AccessTokenButton_ClickAsync(object sender, RoutedEventArgs e
145144
IEnumerable<IAccount> users = await _pca.GetAccountsAsync().ConfigureAwait(false);
146145
IAccount user = users.FirstOrDefault();
147146

148-
result = await _pca.AcquireTokenInteractive(s_scopes).ExecuteAsync(CancellationToken.None).ConfigureAwait(false);
147+
result = await _pca.AcquireTokenInteractive(s_scopes)
148+
.ExecuteAsync(CancellationToken.None)
149+
.ConfigureAwait(false);
149150
}
150151
catch (Exception ex)
151152
{

0 commit comments

Comments
 (0)