.NET의 HttpClient를 사용하여 Azure 모바일 서비스를 사용할 수 있습니까?Azure 모바일 서비스, HttpClient, 인증
HttpClient를 사용하여 custom Authentication/Authorization patterns에 구운 모바일 서비스 자체를 인증하려면 어떻게해야합니까? 내가 어떤 인증 자격 증명을 전달하고 있지 않다 때문에 항상 401을 반환이
:
var client = new HttpClient();
var response = client.GetAsync("http://localhost:49190/api/test").Result;
을 또한, 나는 Mobile Service Client를 사용할 때 와서 어떻게, 왜 내 응용 프로그램 키, 마스터 키, 또는 사용자 인증 키를하지 항상 (401) 무단으로 반환?
클라이언트 :
var mobileClient = new MobileServiceClient("http://localhost:49190/", "[my key]");
var response = mobileClient.InvokeApiAsync("test").Result;
서비스 측면 :
[AuthorizeLevel(AuthorizationLevel.Application)]
public class TestController : ApiController
{
public ApiServices Services { get; set; }
// GET api/Test
public string Get()
{
Services.Log.Info("Hello from custom controller!");
return "Hello";
}
}
매우 유용한 설명과 문서에서 나는 빠져있었습니다. 고맙습니다! –
어디서 열쇠를 얻을 수 있습니까? azure 포털이나 web.config에는 키가 없습니다. – Anthony
@Anthony 내가 이것을 망쳐 놓은 지 오래다. 그러나 나는 확신 할 수 없다. – Porschiey