OAuth2를 통한 인증이 필요한 Windows Store 앱을 만들려고합니다.WinRT - OAuth2 액세스 토큰 받기
선호하는 방법은 WebAuthenticationBroker해야한다 :
const string url = @"https://my.server.srv/mobile-auth/index.pl?"
+ "client_id=CLIENTID"
+ "&redirect_uri=https%3A%2F%2Fmy.server.srv
+ "&response_type=code"
Uri startUri = new Uri(url);
Uri endUri = new Uri("https://my.server.srv");
WebAuthenticationResult webAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, startUri, endUri);
if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
{
string token = webAuthenticationResult.ResponseData;
}
하지만 토큰은 비어 있습니다. 서버 응답이 있어야합니다.
code=a-secret-code&expires_in=600&token_type=bearer
은 OAuth2에 적합합니다.
매개 변수를 가져 오는 방법을 알고 계십니까?
편집 : 해결되었습니다. redirect_uri/endUri로 "https : // localhost"를 전달한 후 작동하기 시작했습니다.
는 서버가 다른 방법이나 도구를 사용하여 적절한 응답을 (반환되는지 확인 했 -
플리커 아마 (! 사진과 함께) 최선의 요약 설명의 OAuth 프로세스가 작동하는 방법이있다 ie Fiddler)? 문제가 WebAuthenticationBroker인지 확인할 수 있습니까? – villecoder
예. 코드 조각 (code = a-secret-code ... _type = bearer)은 Firefox 및 Chrome 브라우저에서 테스트 한 것입니다. (나는 서버의 이름과 그 접근 코드를 숨겼다.) 나의 문제는 WebAuthenticationBroker에게만 알려졌다. – eMko