public async Task <SocailAccount> GetAccountAsync(string accessToken, IEnumerable <string> scops) { using (ExHttpClient httpClient = ExHttpClient.Create()) { using (HttpResponseMessage responseMessage = await httpClient.GetAsync(_urlFactory.Me(accessToken, scops))) { if (responseMessage.StatusCode == HttpStatusCode.OK) { return(new SocailAccount((await responseMessage.Content.ReadAsStringAsync()).ToObject <Models.Api.MeResponseModel>())); } else { return(null); } } } }
public async Task <SocailAccount> GetAccountAsync(string accessToken, IEnumerable <string> scops) { using (ExHttpClient httpClient = ExHttpClient.Create()) { httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); using (HttpResponseMessage responseMessage = await httpClient.GetAsync(_urlFactory.Me(scops))) { if (responseMessage.StatusCode == HttpStatusCode.OK) { return(new SocailAccount((await responseMessage.Content.ReadAsStringAsync()).ToObject <Models.Api.MeResponseModel>())); } else { return(null); } } } }