SCUrlBuilder
@objcMembers
public class SCUrlBuilder : NSObject
A builder used for generating Smartcar Connect authorization URLs. Use the built string with `SmartcarAuth.launchAuthFlow(…) 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
clientIdThe application’s client ID
redirectUriThe application’s redirect URI
scopeAn array of authorization scopes
testModeDeprecated, please use
modeinstead. Optional, launch the Smartcar auth flow in test mode when set to true. Defaults to false.modeOptional, 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) -> SCUrlBuilderParameters
stateAn optional value included on the redirect uri returned to
SmartcarAuth.webAuthSessionCompletion(...)andSmartcarAuth.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) -> SCUrlBuilderParameters
forcePromptSet 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) -> SCUrlBuilderParameters
makeThe 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) -> SCUrlBuilderParameters
singleSelectSet 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) -> SCUrlBuilderParameters
vinThe 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]) -> SCUrlBuilderParameters
flagsList 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) -> SCUrlBuilderReturn 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 orSmartcarAuth.launchWebAuthSession(...)in iOS 11 and aboveDeclaration
Swift
public func build() -> StringReturn Value
An authorization URL string
SCUrlBuilder Class Reference