instaSharp を使用して instagram api を使用し、フォロワーと投稿を取得し、... callbackUrl でコードを取得すると、Requesttoken(code) を送信できず、oauthResponse が null です ... これが私のコードです:
async Task getaouth()
{
var clientId = ConfigurationManager.AppSettings["client_id"];
var clientSecret = ConfigurationManager.AppSettings["client_secret"];
var redirectUri = ConfigurationManager.AppSettings["redirect_uri"];
var realtimeUri = "";
InstagramConfig config = new InstagramConfig(clientId, clientSecret, redirectUri, realtimeUri);
Session.Add("InstaSharp.config", config);
// add this code to the auth object
var auth = new InstaSharp.OAuth(config);
// now we have to call back to instagram and include the code they gave us
// along with our client secret
var oauthResponse = await auth.RequestToken(code);
// tell the session that we are authenticated
//config.isAuthenticated = true;
Response.Write(r.ToString());
// both the client secret and the token are considered sensitive data, so we won't be
// sending them back to the browser. we'll only store them temporarily. If a user's session times
// out, they will have to click on the authenticate button again - sorry bout yer luck.
Session.Add("InstaSharp.AuthInfo", oauthResponse);
// all done, lets redirect to the home controller which will send some intial data to the app
//return RedirectToAction("Index", "Home");
Response.Write("");
}
この後、私の oauthResponse は null です! そして、このメソッド _users.GetSelf() を呼び出した後、私はそれを取得します: タイプ 'System.InvalidOperationException' の例外が InstaSharp.dll で発生しましたが、ユーザー コードで処理されませんでした 追加情報: 認証されていません