Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftUI: usage example for native web login #176

Open
KevM opened this issue May 14, 2024 · 0 comments
Open

SwiftUI: usage example for native web login #176

KevM opened this issue May 14, 2024 · 0 comments

Comments

@KevM
Copy link

KevM commented May 14, 2024

I really appreciate the Usage example for Swift UI. The native web example is just different enough that I'm not sure what to do in the SwiftUI paradigm. My goal is to use native login to make MFA logins go smoother and get better password manager support.

 if let url = api.authenticateWebNativeURL() {
    UIApplication.shared.open(url)
}
...

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    Task { @MainActor in
        do {
            _ = try await api.authenticateWebNative(url: url)
            // Notify your code the auth is done
        } catch {
            print("Error")
        }
    }        
    return true
}

URL Types

A am also not sure what do for this guidance:

If you use deeplinks, add your callback URI scheme as a URL Scheme to your app under info -> URL Types

For the non-native login I added teslaswift://teslaswift as a "Allowed Redirect URI(s)" in the tesla developer dashboard to get things working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant