/// <summary> /// /// </summary> /// <returns></returns> public async Task <string> GetAPIAccessTokenAsync() { var httpHelpers = new HttpHelpers(); try { var response = await httpHelpers.AcquireAuthToken(ConfigurationManager.AppSettings["ida:TenantId"], ConfigurationManager.AppSettings["ida:AppId"], ConfigurationManager.AppSettings["ida:AppSecret"]); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); var oAuthModel = JsonConvert.DeserializeObject <OAuth2Response>(content); return(oAuthModel.AccessToken); } } catch (Exception e) { throw new Exception(Resource.Error_AuthChallengeNeeded); } return(null); }