Client
public class Client : CustomStringConvertible
Represents a client registered with Schibsted account.
-
Initializes the Client with given configuration
Declaration
Swift
public convenience init(configuration: ClientConfiguration, appIdentifierPrefix: String? = nil, tracker: TrackingEventsHandler? = nil, httpClient: HTTPClient? = nil)
Parameters
configuration
Client configuration object
appIdentifierPrefix
Optional AppIdentifierPrefix (Apple team ID). When provided, SDK switches to shared keychain and Simplified Login feature can be used
tracker
The tracking event implementation that will be called at various spots
httpClient
Optional custom HTTPClient
-
Declaration
Swift
public enum AppTransfer
-
Resume any previously logged-in user session.
Declaration
Swift
public func resumeLastLoggedInUser() -> User?
Parameters
completion
The completion handler called when the resume request is complete.
-
Gets an authentication web session. Only one session can be started at the time.
Declaration
Swift
public func getLoginSession(withMFA: MFAType? = nil, state: String? = nil, loginHint: String? = nil, extraScopeValues: Set<String> = [], completion: @escaping LoginResultHandler) -> ASWebAuthenticationSession?
Parameters
withMFA
Optional MFA verification to prompt the user with.
state
Optional string that overrides
state
query item of loginURL, which is otherwise a random 10 character string.loginHint
Optional login hint string.
extraScopeValues
Any additional scope values to request. By default
openid
andoffline_access
will always be included as scope values.completion
The callback that receives the login result.
-
Gets an authentication web session. Only one session can be started at the time.
This method must be used for devices with iOS 13 and up.
Declaration
Swift
@available(iOS 13.0, *) public func getLoginSession(contextProvider: ASWebAuthenticationPresentationContextProviding, withMFA: MFAType? = nil, state: String? = nil, loginHint: String? = nil, extraScopeValues: Set<String> = [], withSSO: Bool = true, completion: @escaping LoginResultHandler) -> ASWebAuthenticationSession?
Parameters
contextProvider
Delegate to provide presentation context for the
ASWebAuthenticationSession
.withMFA
Optional MFA verification to prompt the user with.
loginHint
Optional login hint string.
extraScopeValues
Any additional scope values to request. By default
openid
andoffline_access
will always be included as scope values.withSSO
whether cookies should be shared to enable single-sign on (defaults to true).
completion
callback that receives the login result.
-
Call this with the full URL received as deep link to complete the login flow.
This needs to be used if manually starting the login flow using
getLoginSession
.Declaration
Swift
public func handleAuthenticationResponse(url: URL, completion: @escaping LoginResultHandler)
Parameters
url
Full URL from received deep link upon completion of user authentication.
completion
Callback that receives the login result.
-
Gets an
externalId
identifiying user for a particular brand.Declaration
Swift
public func getExternalId(pairId: String, externalParty: String, suffix: String = "") -> String?
Parameters
pairId
New identifier returned from our back-end.
externalParty
Name of a 3rd-party integration
suffix
Optional if further categorisation is needed
-
Client description containing clientId value.
Declaration
Swift
public var description: String { get }
-
Optional value for the current
state
stored in Client.Declaration
Swift
public var state: String? { get }