I have made several api call to get current users info, but each time I get "UNAUTHORIZED" response.
var userRequest = new HttpRequestMessage(HttpMethod.Get, "https://drchrono.com/api/users/current");
userRequest.Headers.Add("Authorization", "Bearer " + access_token);
var userResponse = await _httpClient.SendAsync(userRequest, Request.CallCancelled);
and I am always getting response like below:-
{StatusCode: 401, ReasonPhrase: 'UNAUTHORIZED', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Transfer-Encoding: chunked
Connection: keep-alive
X-XSS-Protection: 1
X-Content-Options: nosniff
Strict-Transport-Security: max-age=31536000 ; includeSubDomains ; preload
Vary: User-Agent
Vary: Authorization
Vary: Cookie
X-Frame-Options: sameorigin
CF-RAY: 2999cd05ac4d2dcd-BOM
Date: Tue, 26 Apr 2016 11:47:36 GMT
Server: cloudflare-nginx
WWW-Authenticate: Bearer
Content-Type: text/html; charset=utf-8
}}
However, using same access_token I get all patients list, so its not that access_token is not authorized.
like below request
var userRequest = new HttpRequestMessage(HttpMethod.Get, "https://drchrono.com/api/patients");
userRequest.Headers.Add("Authorization", "Bearer " + access_token);
var userResponse = await _httpClient.SendAsync(userRequest, Request.CallCancelled);
Please help what things are missing?
> Some endpoints may return a 302 redirect response. Most libraries handle this incorrectly by resending the response with different headers or a different HTTP method; you need to resend the original request with the right HTTP method and headers to the new Location specified by the 302 response.
https://alifelesatra.drchrono.com/api-docs/v2015_08/documentation