I want to get access token from instagram api in windows store app
Here's my code:
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) { }
I get that error:
The specified protocol is unknown. (Exception from HRESULT: 0x800C000D)
Why don't you directly use 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);
User contributions licensed under CC BY-SA 3.0