public RecipeService(AuthTokenService token) { _token = token; _client.BaseAddress = new Uri("http://localhost:5001"); MediaTypeWithQualityHeaderValue contentType = new MediaTypeWithQualityHeaderValue("application/json"); _client.DefaultRequestHeaders.Accept.Add(contentType); }
public UserService(AuthTokenService token) { _token = token; _client.BaseAddress = new Uri("http://localhost:5001"); MediaTypeWithQualityHeaderValue contentType = new MediaTypeWithQualityHeaderValue("application/json"); _client.DefaultRequestHeaders.Accept.Add(contentType); if (_token.GetToken() != null) { _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _token.GetToken()); } }