Example #1
0
 public void UpdateToken(string key, XdtsTokenResponse token)
 {
     lock (TokenLock)
     {
         string cacheFilePath = Path.Combine(ClientSettings.Singleton.CacheFolder, CacheFile);
         this.CachedTokens[key] = token;
         File.WriteAllText(cacheFilePath, JsonConvert.SerializeObject(this.CachedTokens));
     }
 }
        public async Task <DevAccount> SignInAsync()
        {
            if (this.AuthContext == null)
            {
                throw new InvalidOperationException("User Info is not found.");
            }

            string aadToken = await this.AuthContext.AcquireTokenAsync();

            XdtsTokenResponse token = await this.FetchXdtsToken(aadToken, string.Empty, null);

            this.Account = new DevAccount(token, this.AuthContext.AccountSource);

            return(this.Account);
        }