[GH-ISSUE #170] Error with SafariURLHandler and OAuth2Swift #100

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

Originally created by @bcongdon on GitHub (Jan 9, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/170

When I try to do oauthswift.authorize_url_handler = SafariURLHandler(viewController: self), I get the following error:

Attempt to present <SFSafariViewController: 0x7f9bb978feb0> on <My_App.ViewController: 0x7f9bb96424a0> whose view is not in the window hierarchy!

I've gotten SafariURLHandler to work using OAuth1Swift, but for some reason it returns this error with OAuth2Swift.
I looked into the source and saw nothing that would differentiate these classes enough to cause the issue.

For what it's worth, I'm trying to authenticate with Fitbit using the code -> token change per #159. I'm kinda stumped at this point...

Originally created by @bcongdon on GitHub (Jan 9, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/170 When I try to do `oauthswift.authorize_url_handler = SafariURLHandler(viewController: self)`, I get the following error: ``` Attempt to present <SFSafariViewController: 0x7f9bb978feb0> on <My_App.ViewController: 0x7f9bb96424a0> whose view is not in the window hierarchy! ``` I've gotten `SafariURLHandler` to work using `OAuth1Swift`, but for some reason it returns this error with `OAuth2Swift`. I looked into the source and saw nothing that would differentiate these classes enough to cause the issue. For what it's worth, I'm trying to authenticate with Fitbit using the `code -> token` change per #159. I'm kinda stumped at this point...
kerem closed this issue 2026-03-03 16:45:41 +03:00
Author
Owner

@bcongdon commented on GitHub (Jan 9, 2016):

Whoops, rookie mistake. Tried calling this in ViewDidLoad().

<!-- gh-comment-id:170166302 --> @bcongdon commented on GitHub (Jan 9, 2016): Whoops, rookie mistake. Tried calling this in `ViewDidLoad()`.
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#100
No description provided.