【问题标题】:Logging out of Instagram API注销 Instagram API
【发布时间】:2015-11-23 16:15:18
【问题描述】:

在过去几天仔细阅读了这个网站和许多其他网站后,我决定是时候问我自己的问题了。我正在使用 Instagram API 并想做一个简单的用户注销。我在我身边存储一个会话变量来跟踪用户何时登录,并在他们注销时销毁。销毁会话(以及最终的 Instagram 身份验证令牌)后,我将其设置为重定向到新用户可以登录的主页。除了打嗝之外,我的工作正常。

当我删除会话变量并重定向到主页时,我无法以其他用户身份重新登录。进入 IG 登录页面只会自动登录上次登录的用户。

为了解决这个问题,我尝试过:

  • 清除我的 cookie
  • 在新标签页中打开 IG 注销页面 (instagram.com/accounts/logout),并将其附加到隐藏的 img 和隐藏的 iFrame 中
  • 对注销 url 执行 AJAX 调用

清除我的 cookie 完全没有任何作用。

在新选项卡中打开注销 URL 会自动让我重新登录。

打开一个隐藏的 iFrame 给我一个错误,打开一个隐藏的 img 什么都不做。

由于跨域问题,无法进行 AJAX 调用。

我的代码:

$(document).on("click", "#logout", function()   {

    console.log("logout");

    $.ajax({
            type: "POST",
            dataType: "text",
            data: {token : "-1"},
            url: "http://localhost/Paytag/wp-content/themes/blankslate/set_cookie.php",
            success: function(data){
                console.log(data);
            }
    });

    $("#account-div").append("<img src='http://instagram.com/accounts/logout/' width='0' height='0' />");

    location.href='http://localhost/Paytag';

})

感谢您提供的任何帮助!

【问题讨论】:

    标签: php jquery session instagram instagram-api


    【解决方案1】:

    所以解决方案非常明显。我的登出网址一直是错误的。

    它必须是这个 URL:

    https://www.instagram.com/logout/

    我要么不包括 https://、www 或斜杠,要么不包括这三者的任何组合。我希望这对某人有所帮助!

    【讨论】:

    • 谢谢,当我之前尝试使用该 URL 时,它会将我重定向到注销页面,只是自动让我重新登录。
    【解决方案2】:

    instagram 的注销链接是https://www.instagram.com/accounts/logout/,它对我有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-15
      • 2014-06-10
      • 1970-01-01
      • 2017-05-23
      • 1970-01-01
      • 2016-06-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多