public async Task <bool> SignInMsaAsync()
        {
            string refreshToken = await MSAOAuthHelpers.GetRefreshTokenAsync();

            if (!string.IsNullOrEmpty(refreshToken))
            {
                var account = new Account(m_platform, Guid.NewGuid().ToString(),
                                          ConnectedDevicesAccountType.MSA, refreshToken, AccountRegistrationState.InAppCacheOnly);
                m_accounts.Add(account);
                await account.InitializeAccountAsync();

                AccountListChanged();
                return(true);
            }

            return(false);
        }
Example #2
0
        public async Task <bool> SignInMsa()
        {
            string refreshToken = string.Empty;

            if (ApplicationData.Current.LocalSettings.Values.ContainsKey(MsaTokenKey))
            {
                refreshToken = ApplicationData.Current.LocalSettings.Values[MsaTokenKey] as string;
            }

            if (string.IsNullOrEmpty(refreshToken))
            {
                refreshToken = await MSAOAuthHelpers.GetRefreshTokenAsync();
            }

            if (!string.IsNullOrEmpty(refreshToken))
            {
                MsaToken = refreshToken;
                ApplicationData.Current.LocalSettings.Values[MsaTokenKey] = refreshToken;
                SignedInAccount = new ConnectedDevicesUserAccount(Guid.NewGuid().ToString(), ConnectedDevicesUserAccountType.MSA);
                return(true);
            }

            return(false);
        }