Exemple #1
0
        public static async Task GetToken()
        {
            string tokenURL = string.Format(B2CConfig.TokenURL, B2CConfig.Tenant, B2CPolicy.SignInPolicyId, B2CConfig.ClientId, PreferenceHandler.GetAccessCode());
            var    response = await InvokeApi.Authenticate(tokenURL, string.Empty, HttpMethod.Post);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                string strContent = await response.Content.ReadAsStringAsync();

                var tokenNew = JsonConvert.DeserializeObject <AccessToken>(strContent);
                PreferenceHandler.SetToken(tokenNew.id_token);
                PreferenceHandler.SetRefreshToken(tokenNew.refresh_token);
            }
        }