SCUrlBuilder

@objcMembers
public class SCUrlBuilder : NSObject

A builder used for generating Smartcar Connect authorization URLs. Use the built string with SmartcarAuth.launchAuthFlow(...) in iOS 10 and under or SmartcarAuth.launchWebAuthSession(...) in iOS 11 and above To see a full description of Smartcar Connect parameters, see the Smartcar API Reference

  • Constructor for SCUrlBuilder. Represents the minimum requirements for an authorization URL.

    Declaration

    Swift

    public init(clientId: String, redirectUri: String, scope: [String], testMode: Bool = false, mode: SCMode? = nil)

    Parameters

    clientId

    The application’s client ID

    redirectUri

    The application’s redirect URI

    scope

    An array of authorization scopes

    testMode

    Deprecated, please use mode instead. Optional, launch the Smartcar auth flow in test mode when set to true. Defaults to false.

    mode

    Optional, determine what mode Smartcar Connect should be launched in. Should be one of test, live or simulated. If none specified, defaults to live mode.

  • Set an optional state parameter

    Declaration

    Swift

    public func setState(state: String) -> SCUrlBuilder

    Parameters

    state

    An optional value included on the redirect uri returned to SmartcarAuth.webAuthSessionCompletion(...) and SmartcarAuth.handleCallback(...)

    Return Value

    A reference to this object

  • Force display of the grant approval dialog in Smartcar Connect.

    Defaults to false and will only display the approval dialog if the user has not previously approved the scope. Set this to true to ensure the approval dialog is always shown to the user even if they have previously approved the same scope.

    Declaration

    Swift

    public func setForcePrompt(forcePrompt: Bool) -> SCUrlBuilder

    Parameters

    forcePrompt

    Set to true to ensure the grant approval dialog is always shown

    Return Value

    A reference to this object

  • Bypass the brand selector screen to a specified make.

    A list of compatible makes is available on the Smartcar API Reference

    Declaration

    Swift

    public func setMakeBypass(make: String) -> SCUrlBuilder

    Parameters

    make

    The selected make

    Return Value

    A reference to this object

  • Ensure the user only authorizes a single vehicle.

    A user’s connected service account can be connected to multiple vehicles. Setting this parameter to true forces the user to select only a single vehicle.

    Declaration

    Swift

    public func setSingleSelect(singleSelect: Bool) -> SCUrlBuilder

    Parameters

    singleSelect

    Set to true to ensure only a single vehicle is authorized

    Return Value

    A reference to this object

  • Specify the vin a user can authorize in Smartcar Connect. When setSingleSelect(...) is set to true, this parameter can be used to ensure that Smartcar Connect will allow the user to authorize only the vehicle with a specific VIN.

    Declaration

    Swift

    public func setSingleSelectVin(vin: String) -> SCUrlBuilder

    Parameters

    vin

    The specific VIN to authorize

    Return Value

    A reference to this object

  • Set flags to enable early access features.

    Declaration

    Swift

    public func setFlags(flags: [String]) -> SCUrlBuilder

    Parameters

    flags

    List of feature flags that your application has early access to.

    Return Value

    A reference to this object

  • Specify a unique identifier for the vehicle owner to track and aggregate analytics across Connect sessions for each vehicle owner

    Declaration

    Swift

    public func setUser(user: String) -> SCUrlBuilder

    Return Value

    A reference to this object

  • Build a Smartcar Connect authorization URL string

    Use the built string with SmartcarAuth.launchAuthFlow(...) in iOS 10 and under or SmartcarAuth.launchWebAuthSession(...) in iOS 11 and above

    Declaration

    Swift

    public func build() -> String

    Return Value

    An authorization URL string