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;
  • The name of the identity provider which generated the credentials token.

    Declaration

    Objective-C

    @property (nonatomic, readonly) RLMIdentityProvider _Nonnull provider;
  • A dictionary containing additional pertinent information. In most cases this is automatically configured.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSDictionary<NSString *, id> *_Nonnull userInfo;
  • Construct and return credentials from a Facebook account token.

    Declaration

    Objective-C

    + (nonnull instancetype)credentialsWithFacebookToken:
        (nonnull RLMSyncCredentialsToken)token;
  • Construct and return credentials from a Google account token.

    Declaration

    Objective-C

    + (nonnull instancetype)credentialsWithGoogleToken:
        (nonnull RLMSyncCredentialsToken)token;
  • Construct and return credentials from an CloudKit account token.

    Declaration

    Objective-C

    + (nonnull instancetype)credentialsWithCloudKitToken:
        (nonnull RLMSyncCredentialsToken)token;
  • 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;
  • Construct and return credentials from a JSON Web Token.

    Declaration

    Objective-C

    + (nonnull instancetype)credentialsWithJWT:(nonnull NSString *)token;
  • Construct and return anonymous credentials

    Declaration

    Objective-C

    + (nonnull instancetype)anonymousCredentials;
  • Deprecated

    Use +credentialsWithUsername instead

    Construct and return credentials from a nickname

    Declaration

    Objective-C

    + (nonnull instancetype)credentialsWithNickname:(nonnull NSString *)nickname
                                            isAdmin:(BOOL)isAdmin;
  • 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;
  • 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 of identity and isAdmin 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;
  • 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;