mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 20:55:57 +03:00
[GH-ISSUE #594] SwiftUI Webview authorizeURLHandler #386
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#386
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Veeit on GitHub (May 6, 2020).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/594
Description:
My SwiftUI application is working fine with oAuthSwift, the only problem is I use Safari for the login handler. But to get the app to the store I need to use a WebView inside my application, the problem that I have now is that I don't know how to create a authorizeURLHandler that opens a SwiftUI sheet with the WebView inside.
OAuth Provider? (Twitter, Github, ..):
Makerlog
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
Xcode version:
11.x (Swift 5.1)
10.x (Swift 5.0)
10.x (Swift 4.1)
9.3 (Swift 4.1)
9.0 (Swift 4.0)
other: (Please fill in the version you are using.)
objective c
@phimage commented on GitHub (May 6, 2020):
good question, never tested
did you try other handler like SafariURLHandler or ASWebAuthenticationURLHandler?
@Veeit commented on GitHub (May 6, 2020):
I didn't I just looked at SafariURLHandler but I need to add a Controller and I don't have one. I have created a function inside my ObservableObject for the login.
The big problem is I need to warp the WebView (or what ever the webpage displays) inside a UIViewControllerRepresentable to use it with swiftUI.
@Veeit commented on GitHub (May 6, 2020):
https://github.com/Veeit/makerslog-App/blob/release-v1/Shared/View%20Model/Api/LoginData.swift
line 258 is the login function, if you are interested in the code :)
@Veeit commented on GitHub (May 21, 2020):
Got it working :) I need to configure the SafariURLHandler like this inside the SceneDelegate, actually it took me a while to get to thins solution but that is simple.
@phimage commented on GitHub (May 24, 2020):
thanks for the code it could help other people