tdip09 tdip09 - 5 months ago 21
iOS Question

After signing into Instagram in my iOS app how can I sign in as a different user?

So I am building an

iOS
with instagram integration. I registered my app with instagram and have everything working so far. When the user clicks the ADD ACCOUNT button, I load the instagram auth url (https://instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token) into a webview and the instagram login page appears.

I can then successfully login, my redirect then redirects correctly, and I can then exchange the code for an access token, close the webview, and display an alert saying that login was successful. But when the user clicks the ADD ACCOUNT button again and the webview loads the auth url, instead of seeing the instagram login page, it automatically authorizes and the successful login alert appears.

Is the webview caching something? How would I prevent this?

Answer

try clear caches and cookies

clear caches:

[[NSURLCache sharedURLCache] removeAllCachedResponses];

to remove cookies check those two questions:

How to delete all cookies of UIWebView?

Delete cookies UIWebView

Comments