Instagram API iOS client can log out of Instagram

I have an application where a user logs into Instagram using implicit auth with Oauth 2. Is there a way for the user to log out or re-register as a different user?

As of now, when I call the authorization URL after the user is logged in, the Safari browser starts, then returns to the application without displaying the login fields. I need Safari to display login fields and allow the user to enter uname and go through before the control is returned to the application.

+3


source to share


3 answers


You can delete cookies from instagram as follows



       let cookieJar : NSHTTPCookieStorage = NSHTTPCookieStorage.sharedHTTPCookieStorage()
    for cookie in cookieJar.cookies! as [NSHTTPCookie]{
        NSLog("cookie.domain = %@", cookie.domain)

        if cookie.domain == "www.instagram.com" ||
            cookie.domain == "api.instagram.com"{

            cookieJar.deleteCookie(cookie)
        }
    }

      

+12


source


call the url for instagram registration ( https://instagram.com/accounts/logout ) and then call the url.



You can implement a logout button, so when the user logs out, it has to call the logout url and then wait for the delay, show the login button and then ask the user to log in.

+2


source


Please delete your cookies, thats it. Happy Coding

0


source







All Articles