0

我想从 Windows 商店应用程序中的 instagram api 获取访问令牌

这是我的代码:

string endURL = "ms-app://..";  string clientID = "..";
Uri endUri = new Uri(endURL);
string startURL = "https://api.instagram.com/oauth/authorize/?"
                + "client_id=" + clientID
                + "&redirect_uri=" + endURL
                + "&response_type=code";
try
{
    WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync
        (WebAuthenticationOptions.None, startUri);
    if (result.ResponseStatus == WebAuthenticationStatus.Success) {
        string token = webAuthenticationResult.ResponseData;
}
catch(Exception) { }

我得到那个错误:

指定的协议未知。(来自 HRESULT 的异常:0x800C000D)

4

1 回答 1

0

为什么不直接使用 InstaAPI github & codeplex呢?


List<Scope> scopes = new List<Scope>() { Scope.basic };
InstaConfig config = new InstaConfig("CLIENT_ID", "CLIENT_SECRET", "REDIRECT_URI", scopes);

// use this to redirect user for authenticating your application
String AuthenticationUriString = config.GetAuthenticationUriString(); 

OAuth oauth = new OAuth(config, "CODE_ATTACHED_WITH_REDIRECTEDURI_AFTERSUCCESSFUL_AUTHENTICATION");
AuthUser user = oauth.GetAuhtorisedUser();

Console.WriteLine(user.AccessToken);
于 2015-02-25T08:32:55.260 回答