[GH-ISSUE #228] How to access OAuthSwift WebView? #128

Closed
opened 2026-03-03 16:45:55 +03:00 by kerem · 1 comment
Owner

Originally created by @SamL98 on GitHub (May 15, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/228

I am writing an app for iOS 8.0 using OAuthSwift. I am trying to implement logout functionality. I have already deleted cookies, cleared the cache, and synchronized nsuserdefaults. However, the web browser that oauthswift sends me to keeps me logged in. I read that I needed to also call:

<UIWebView>.stringByEvaluatingJavaScriptFromString("localStorage.clear();")!

However, I don't know how to access the webview (or is it an SFSafariController?) to be able to clear it.

Originally created by @SamL98 on GitHub (May 15, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/228 I am writing an app for iOS 8.0 using OAuthSwift. I am trying to implement logout functionality. I have already deleted cookies, cleared the cache, and synchronized nsuserdefaults. However, the web browser that oauthswift sends me to keeps me logged in. I read that I needed to also call: `<UIWebView>.stringByEvaluatingJavaScriptFromString("localStorage.clear();")!` However, I don't know how to access the webview (or is it an SFSafariController?) to be able to clear it.
kerem 2026-03-03 16:45:55 +03:00
Author
Owner

@phimage commented on GitHub (May 15, 2016):

Did you set the authorize_url_handler ?
If not, an external safari app is open and you cannot do anything I suppose...
You must set your custom handler to use your own web view, see demo app for instance

(SFSafariController is iOS9 and must be set explicitly)

<!-- gh-comment-id:219290560 --> @phimage commented on GitHub (May 15, 2016): Did you set the authorize_url_handler ? If not, an external safari app is open and you cannot do anything I suppose... You must set your custom handler to use your own web view, see demo app for instance (SFSafariController is iOS9 and must be set explicitly)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#128
No description provided.