切换用户或使用 Instagram 重新进行身份验证 [英] Switch user or re authenticate with Instagram

查看:46
本文介绍了切换用户或使用 Instagram 重新进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照 Instagram 文档,我可以轻松验证用户身份并检索 access_token

Following the Instagram documentation I'm able to authenticate a user and retrieve an access_token easily

但是现在我想更改 Instagram 帐户,这是不可能的,因为浏览器会自动调用我的回调 URL,因为我已经使用帐户登录(再次没有登录/授权表)

But now I want to change of Instagram account which is impossible since the browser automatically call my callback URL because I'm already signed in with an account (there is no login / authorization form again)

要解释这里发生的事情是身份验证/授权流程:

To explain what happen here is the authenticate / authorization flow :

  1. 打开浏览器,要求用户登录并授权
  2. 用户填写表单并提交(用户已登录时跳过此步骤!)
  3. 浏览器重定向到回调 URL

您看到第 2 步已被跳过,因此我们无法使用其他用户登录

You see step 2 is skipped so we can't login with another user

Instagram 是否有强制重新登录的参数?

Does the Instagram have a parameter to force relogin ?

推荐答案

Justin Powell 的回答正在为注销而工作,但我也需要能够在之后登录对Android来说很烦人

Justin Powell answer is working for log out but I need to be also able to log in just after and it's quite anoying for Android

但它为我指明了正确的方向:Instagram(像其他网站一样)使用会话变量(cookie 也是如此)维护我们的登录

But it points me in the right direction : Instagram (like other website) maintains our login with session variable (so with cookies)

所以为了避免总是登录,我们只需要找到并删除正确的 cookie,这里是如何在 Android 上做到这一点:

So to avoid to be always loged in, we just have to find and remove the correct cookie, here is how to do it with Android :

    String cookieString = "sessionid=''";
    CookieManager.getInstance().setCookie("instagram.com", cookieString);

通过这个,我将 Instagram sessionid cookie 设置为空字符串,这样 Instagram 就不再识别我了

With this I set the Instagram sessionid cookie to en empty string so Instagram doesn't recognize me anymore

这篇关于切换用户或使用 Instagram 重新进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆