Example #1
0
        public async Task <HttpResponseMessage> CallServiceEx(string sTarget, bool fRequireAuth, string[] rgsScopes)
        {
            string sAccessToken = fRequireAuth ? m_accessTokenProvider.GetAccessTokenForScope(rgsScopes) : null;

            if (sAccessToken == null && fRequireAuth == true)
            {
                throw new Exception("Authentication failed, no access token");
            }

            HttpClient client = HttpClientCreate(sAccessToken);

            return(await GetServiceResponse(client, $"{sTarget}"));
        }