Ejemplo n.º 1
0
        public RecipeService(AuthTokenService token)
        {
            _token = token;
            _client.BaseAddress = new Uri("http://localhost:5001");
            MediaTypeWithQualityHeaderValue contentType = new MediaTypeWithQualityHeaderValue("application/json");

            _client.DefaultRequestHeaders.Accept.Add(contentType);
        }
Ejemplo n.º 2
0
        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());
            }
        }