RLMSyncCredentials
@interface RLMSyncCredentials : NSObject
Opaque credentials representing a specific Realm Object Server user.
-
An opaque credentials token containing information that uniquely identifies a Realm Object Server user.
Declaration
Objective-C
@property (nonatomic, readonly) RLMSyncCredentialsToken _Nonnull token;
Swift
var token: String { get }
-
The name of the identity provider which generated the credentials token.
Declaration
Objective-C
@property (nonatomic, readonly) RLMIdentityProvider _Nonnull provider;
Swift
var provider: RLMIdentityProvider { get }
-
A dictionary containing additional pertinent information. In most cases this is automatically configured.
Declaration
Objective-C
@property (nonatomic, readonly) NSDictionary<NSString *, id> *_Nonnull userInfo;
Swift
var userInfo: [String : Any] { get }
-
Construct and return credentials from a Facebook account token.
Declaration
Objective-C
+ (nonnull instancetype)credentialsWithFacebookToken: (nonnull RLMSyncCredentialsToken)token;
Swift
convenience init(facebookToken token: String)
-
Construct and return credentials from a Google account token.
Declaration
Objective-C
+ (nonnull instancetype)credentialsWithGoogleToken: (nonnull RLMSyncCredentialsToken)token;
Swift
convenience init(googleToken token: String)
-
Construct and return credentials from an CloudKit account token.
Declaration
Objective-C
+ (nonnull instancetype)credentialsWithCloudKitToken: (nonnull RLMSyncCredentialsToken)token;
Swift
convenience init(cloudKitToken token: String)
-
Construct and return credentials from a Realm Object Server username and password.
Declaration
Objective-C
+ (nonnull instancetype)credentialsWithUsername:(nonnull NSString *)username password:(nonnull NSString *)password register:(BOOL)shouldRegister;
Swift
convenience init(username: String, password: String, register shouldRegister: Bool)
-
Construct and return credentials from a JSON Web Token.
Declaration
Objective-C
+ (nonnull instancetype)credentialsWithJWT:(nonnull NSString *)token;
Swift
convenience init(jwt token: String)
-
Construct and return anonymous credentials
Declaration
Objective-C
+ (nonnull instancetype)anonymousCredentials;
Swift
class func anonymous() -> Self
-
Deprecated
Use +credentialsWithUsername instead
Construct and return credentials from a nickname
Declaration
Objective-C
+ (nonnull instancetype)credentialsWithNickname:(nonnull NSString *)nickname isAdmin:(BOOL)isAdmin;
Swift
convenience init(nickname: String, isAdmin: Bool)
-
Construct and return special credentials representing a token that can be directly used to open a Realm. The identity is used to uniquely identify the user across application launches.
Warning
The custom user identity will be deprecated in a future release.
Warning
Do not specify a user identity that is the URL of an authentication server.
Warning
When passing an access token credential into any of
RLMSyncUser
‘s login methods, you must always specify the same authentication server URL, or none at all, every time you call the login method.Declaration
Objective-C
+ (nonnull instancetype)credentialsWithAccessToken: (nonnull RLMServerToken)accessToken identity:(nonnull NSString *)identity;
Swift
convenience init(accessToken: String, identity: String)
-
Construct and return special credentials representing a token issued by an external entity that will be used instead of a ROS refresh token.
@discussion Unlike other types of credentials, CustomRefreshToken credentials do not participate in the regular login flow, because they take place of the refresh tokens login produces. Instead, the token will be used to authorize each server operation such as opening a Realm or editing permissions. When the token expires the SyncUser object will still be valid, but server operations will fail until the token is updated.
@remark ROS must be configured to accept the external issuing identity as a refresh token validator.
Warning
The values ofidentity
andisAdmin
are used for client-side validation only. The server will compute their values based on the token string and the token validator configuration, but it’s important for correct functioning that the values here match the server.Declaration
Objective-C
+ (nonnull instancetype) credentialsWithCustomRefreshToken:(nonnull NSString *)token identity:(nonnull NSString *)identity isAdmin:(BOOL)isAdmin;
Swift
convenience init(customRefreshToken token: String, identity: String, isAdmin: Bool)
-
Construct and return credentials with a custom token string, identity provider string, and optional user info. In most cases, the convenience initializers should be used instead.
Declaration
Objective-C
- (nonnull instancetype) initWithCustomToken:(nonnull RLMSyncCredentialsToken)token provider:(nonnull RLMIdentityProvider)provider userInfo:(nullable NSDictionary *)userInfo;
Swift
init(customToken token: String, provider: RLMIdentityProvider, userInfo: [AnyHashable : Any]? = nil)