Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch user or re authenticate with Instagram

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

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. Open a browser asking user to log and authorize
  2. User fill up form and submit (this step is skipped when user is already signed in !)
  3. Browser redirect to callback URL

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

Does the Instagram have a parameter to force relogin ?

like image 669
Plumillon Forge Avatar asked Oct 15 '14 08:10

Plumillon Forge


1 Answers

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

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

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);

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

like image 174
Plumillon Forge Avatar answered Oct 20 '22 05:10

Plumillon Forge