SCSAuthenticationSettings
@interface SCSAuthenticationSettings : NSObject
Authentication settings for the Snap-ins SDK. This class is necessary if you want to use any of the SDK features in authenticated mode. You’ll need to authenticate, for instance, if you want to access a knowledge base only accessible to logged in users, or if you want a user to view and manage their cases. Create an instance of this class using one of the provided initialization methods.
You can either authenticate explicitly using
-[SCServiceCloud setAuthenticationSettings:forServiceType:completion:]
or you can authenticate on-demand by implementing
-[SCServiceCloudDelegate serviceCloud:shouldAuthenticateServiceType:completion:].
To learn more about authentication, see Authentication.
-
Indicates whether these settings apply to a guest user who is not authenticated.
Declaration
Objective-C
@property (readonly, getter=isGuestUser, assign, nonatomic) BOOL guestUser;Swift
var isGuestUser: Bool { get } -
Indicates whether the specified authentication settings are valid.
Declaration
Objective-C
@property (readonly, getter=areSettingsValid, assign, nonatomic) BOOL settingsValid;Swift
var areSettingsValid: Bool { get } -
Indicates whether the settings are being verified.
Declaration
Objective-C
@property (readonly, getter=isVerifyingSettings, assign, nonatomic) BOOL verifyingSettings;Swift
var isVerifyingSettings: Bool { get } -
The name of the user for these authentication settings.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *username;Swift
var username: String? { get } -
Initializes this object as a guest user who is not authenticated.
Declaration
Objective-C
- (nonnull instancetype)initWithGuestCommunityUrl:(nonnull NSURL *)communityUrl;Swift
init(guest communityUrl: URL)Parameters
communityUrlThe URL of the community that accepts guest users.
-
Initializes this object using a dictionary of authentication settings. Refer to
SCSOAuth2JSONKeyfor information about which dictionary keys are required.See
Declaration
Objective-C
- (nullable instancetype) initWithOAuth2Dictionary: (nonnull NSDictionary<SCSOAuth2JSONKey, NSString *> *)dictionary clientId:(nonnull NSString *)clientId;Swift
init?(oauth2 dictionary: [SCSOAuth2JSONKey : String], clientId: String)Parameters
dictionaryThe dictionary of authentication settings. The keys are of type
SCSOAuth2JSONKeyand the values are strings.clientIdThe unique client ID for these authentication settings.
-
Initializes this object with a user account from the Salesforce Mobile SDK. This method automatically extracts all relevant information from the user account.
Declaration
Objective-C
- (nullable instancetype)initWithMobileSDKAccount: (nonnull SFUserAccount *)account;Swift
init?(mobileSDK account: SFUserAccount)Parameters
accountThe mobile SDK user account from which to extract authentication settings.
-
Undocumented
Declaration
Objective-C
- (instancetype)init NS_UNAVAILABLE; -
Verifies that the authentication settings are valid.
Declaration
Objective-C
- (void)verifySettingsWithCompletion: (nonnull void (^)(BOOL, NSError *_Nullable __strong))completion;Swift
func verifySettings(completion: @escaping (Bool, Error?) -> Void)Parameters
completionCompletion block that is called after the verification process.
-
Indicates whether the account has been registered for notifications.
Declaration
Objective-C
@property (readonly, getter=isRegisteredForPushNotifications, assign, nonatomic) BOOL registeredForPushNotifications;Swift
var isRegisteredForPushNotifications: Bool { get } -
Indicates if the account is able to register for push notifications.
Declaration
Objective-C
- (BOOL)supportsPushNotifications;Swift
func supportsPushNotifications() -> BoolReturn Value
YESif this account can support registering for push notifications. -
Registers the given device token for push notifications for the given account. If the current account is already registered, it automatically unregisters the previous token.
Declaration
Objective-C
- (void)registerForPushNotifications:(nonnull NSData *)deviceToken completion: (nullable void (^)( BOOL, NSError *_Nullable __strong))completion;Swift
func register(forPushNotifications deviceToken: Data, completion: ((Bool, Error?) -> Void)? = nil)Parameters
deviceTokenDevice token supplied by the
-[UIApplicationDelegate application:didRegisterForRemoteNotificationsWithDeviceToken:]method.completionCompletion block that is called after the registration attempt.
-
Unregisters the account from push notification support.
Declaration
Objective-C
- (void)unregisterForPushNotifications: (nullable void (^)(BOOL, NSError *_Nullable __strong))completion;Swift
func unregister(forPushNotifications completion: ((Bool, Error?) -> Void)? = nil)Parameters
completionCompletion block that is called after the attempt to unregister.
Install in Dash
SCSAuthenticationSettings Class Reference