Browser

@objc(FRBrowser)
public class Browser : NSObject
extension Browser: SFSafariViewControllerDelegate
extension Browser: ASWebAuthenticationPresentationContextProviding

Browser is a representation of external user-agent (using Authentication Service, Native Browser Application, or SFSafariViewController)

  • Static shared instance of current Browser object

    Declaration

    Swift

    @objc
    public static var currentBrowser: Browser?

Authentication

  • Performs external user-agent login with /authorize request to obtain authorization_code, and exchange with OAuth2 token(s)

    Declaration

    Swift

    @objc
    public func login(completion: @escaping UserCallback)

    Parameters

    completion

    Completion callback that returns FRUser object on success, or error on failure

End Session

  • Performs external user-agent logout with /endSession request

    Declaration

    Swift

    @objc
    public func logout(completion: @escaping UserCallback)

    Parameters

    completion

    Completion callback that returns an error on failure

  • Cancels currently performing authentication process, and closes all current browser session

    Declaration

    Swift

    @objc
    public func cancel()
  • Validates if URL is returning from Centralized Login /authorize flow, and exchanges authorization code for OAuth2 token

    Note: If authorization_code is not found in URL, Browser authentication process will be automatically cancelled.

    Declaration

    Swift

    @objc
    public static func validateBrowserLogin(url: URL) -> Bool

    Parameters

    url

    Returning URL

    Return Value

    Boolean result of whether or not URL contains authorization_code

SFSafariViewControllerDelegate

ASWebAuthenticationPresentationContextProviding

  • Delegation method for ASWebAuthenticationPresentationContextProviding; only available for iOS 13.0 or above

    Declaration

    Swift

    @available(iOS 13.0, *)
    @MainActor
    public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor