<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexander248365</title>
    <description>The latest articles on DEV Community by Alexander248365 (@alexander248365).</description>
    <link>https://dev.to/alexander248365</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F463208%2Ff21c8331-ea0b-4b77-904f-a1768ea889c1.png</url>
      <title>DEV Community: Alexander248365</title>
      <link>https://dev.to/alexander248365</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexander248365"/>
    <language>en</language>
    <item>
      <title>Modern authentication with Azure AD for WinForms (native) apps  - Question to Christos</title>
      <dc:creator>Alexander248365</dc:creator>
      <pubDate>Wed, 02 Feb 2022 19:05:52 +0000</pubDate>
      <link>https://dev.to/alexander248365/modern-authentication-with-azure-ad-for-winforms-native-apps-question-to-christos-5e07</link>
      <guid>https://dev.to/alexander248365/modern-authentication-with-azure-ad-for-winforms-native-apps-question-to-christos-5e07</guid>
      <description>&lt;p&gt;Hi Christos, &lt;/p&gt;

&lt;p&gt;You published a great tutorial on accessing Azure through MSAL authentication, &lt;/p&gt;

&lt;p&gt;&lt;a href="https://cmatskas.com/modern-authentication-with-azure-ad-for-winforms-native-apps-2/"&gt;https://cmatskas.com/modern-authentication-with-azure-ad-for-winforms-native-apps-2/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It would be great if you could clarify additional two points:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Is there an option to store user ID/pwd and to access Azure Graph in Windows Forms Desktop applicatin?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I tried to follow up steps that you've posted and got an issue: FirstAccount is null, even though accounts is not null:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    AuthenticationResult authResult = null;
    var accounts = await Program.PublicClientApp.GetAccountsAsync();
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// AW: accounts != null was always true&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        if (accounts != null)
        { label2.Text += $"GetAccountsAsync passed!"; }
        else
        { label2.Text += "PublicClientApp.GetAccountsAsync returned an empty list"; }


        var firstAccount = accounts.FirstOrDefault();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;//AW: firstAccount is NULL&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        if (firstAccount != null)
        { label2.Text += firstAccount.Username; }
        else
        { label2.Text += "firstAccount is null"; }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This NULL shows before the login screen to MS shows up.&lt;/p&gt;

&lt;p&gt;Any ideas on what could go wrong?&lt;/p&gt;

&lt;p&gt;Thank you.&lt;br&gt;
Alexander&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
