StitchUser

public protocol StitchUser : CoreStitchUser

The StitchUser represents the the user who is logged in to the StitchAppClient.

You can retrieve an instance from StitchAuth or from the StitchResult of certain methods.

You will find information about the user such as name and email address in the StitchUserProfile property profile.

See also

StitchAuth
  • id

    The String representation of the ID of this Stitch user.

    Declaration

    Swift

    var id: String { get }
  • The type of Authentication Provider used to log in as this user.

    Declaration

    Swift

    var loggedInProviderType: StitchProviderType { get }
  • The name of the Authentication Provider used to log in as this user.

    Declaration

    Swift

    var loggedInProviderName: String { get }
  • A string describing the type of this user, either "normal" or "server".

    "server" users are users authenticated via a server API key generated in the MongoDB Stitch admin console. All other users are "normal" users.

    Declaration

    Swift

    var userType: String { get }
  • A StitchUserProfile describing this user.

    Declaration

    Swift

    var profile: StitchUserProfile { get }
  • An array of StitchUserIdentity objects representing the identities linked to this user which can be used to log in as this user.

    Declaration

    Swift

    var identities: [StitchUserIdentity] { get }
  • If this user is currently logged in.

    Declaration

    Swift

    var isLoggedIn: Bool { get }
  • The last time this user was logged in, logged out, switched to, or switched from. This is stored as the TimeInterval (seconds) since the Unix Epoch.

    Declaration

    Swift

    var lastAuthActivity: TimeInterval { get }
  • Links the currently authenticated StitchUser with a new identity, where the identity is defined by the credential specified as a parameter.

    This will only be successful if this StitchUser is the currently authenticated StitchUser.

    Declaration

    Swift

    func link(withCredential credential: StitchCredential, _ completionHandler: @escaping (StitchResult<StitchUser>) -> Void)

    Parameters

    withCredential

    The StitchCore.StitchCredential used to link the user to a new identity. Credentials can be retrieved from an authentication provider client, which is retrieved using the getProviderClient method on StitchAuth.

    completionHandler

    The completion handler to call when the linking is complete. This handler is executed on a non-main global DispatchQueue. If the operation is successful, the result will contain a StitchUser object representing the currently logged in user.