const string client_id 6ba3d4e99c1b4c61bc69 328c53ea7093 const string

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const string client_id = "6ba3d4e99c1b4c61bc69328c53ea7093";
const string redirect_uri = "https://localhost";
const string request_uri = "https://api.instagram.com/oauth/authorize/?client_id=" +
client_id + "&redirect_uri=" + redirect_uri + "&response_type=code";
Uri requestUri = new Uri(request_uri);
Uri callbackUri = new Uri("https://localhost");
WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, requestUri, callbackUri);
switch (result.ResponseStatus)
{
case WebAuthenticationStatus.ErrorHttp:
MessageDialog dialogError = new MessageDialog("Не удалось открыть страницу сервиса\n" +
"Попробуйте войти в приложения позже!", "Ошибка");
dialogError.ShowAsync();
break;
case WebAuthenticationStatus.Success:
string responseString = result.ResponseData;
MessageDialog dialogSuccess = new MessageDialog(responseString);
dialogSuccess.ShowAsync();
break;
}