// // Auth.swift // Hæ-appen // // Created by Ivar Løvlie on 03/12/2025. // import SwiftUI import AuthenticationServices import OSLog struct Auth { let logger = Logger(subsystem: "ivarivarivar.Haeappen", category: "auth") func login() -> Void { guard let url = URL(string:"http://192.168.0.103:5281/login") else {return} let session = ASWebAuthenticationSession(url: url, callbackURLScheme: "what") { callbackURL, error in guard error == nil, let callbackURL = callbackURL else { return } let queryItems = URLComponents(string: callbackURL.absoluteString)?.queryItems _ = queryItems?.filter({ $0.name == "code" }).first?.value } let vc = AuthViewController() session.presentationContextProvider = vc session.start() return } func register() -> Void { return } func logout() -> Void { return } } class AuthViewController: UIViewController, ASWebAuthenticationPresentationContextProviding { func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { return ASPresentationAnchor() } }