UIWebView OAuth in iOS


I’m trying to figure out a solution for the OAuth process on Twitter’s in-app browser, using our system.
The flow goes something like this:

  • User clicks ‘Sign in with Twitter’ link from one page (window A).
  • New window (window B) opens with Twitter’s OAuth
  • User enters credentials
  • (window B) redirects to our callback page and closes (window B) via JS (window.close())
  • (window A) intervally checks if (window B) is closed
  • if successful, (window A) reloads itself with User credentials

This process works on any browser but when on iOS Twitter’s in-app browser (which I assume uses UIWebView), (window B) doesn’t close. Neither can I switch browser tabs on Twitter’s in-app browser, giving me the impression that it supports only one browser tab, having (window B) override (window A) if that is so…

window.open and window.close don’t seem to function accordingly. Are there work arounds for this? Any suggestions would be gladly accepted and helpful.

Do keep in mind that (window B) has to exist, this is due to our system requirements. Our system cannot function without OAuth being called in a popup or new window.