Class: StitchClient

StitchClient()

Prototype for StitchClient class.
This is the internal implementation for StitchClient and should not
be exposed.

Constructor

new StitchClient()

Methods

authedId() → {String}

Returns:

Returns a string of the currently authed user's ID.

Type
String

authenticate(providerType, optionsopt) → {Promise}

Submits an authentication request to the specified provider providing any
included options (read: user data). If auth data already exists and the
existing auth data has an access token, then these credentials are returned.

Parameters:
Name Type Attributes Description
providerType String

the provider used for authentication (e.g. 'userpass', 'facebook', 'google')

options Object <optional>

additional authentication options

Returns:

which resolves to a String value: the authed userId

Type
Promise

authError() → {*}

Returns:

Returns any error from the Stitch authentication system.

Type
*

createApiKey(userApiKeyName) → {Promise}

Creates a user api key

Parameters:
Name Type Description
userApiKeyName String

the user defined name of the userApiKey

Returns:
Type
Promise

deleteApiKeyByID(keyID) → {Promise}

Deletes a user api key

Parameters:
Name Type Description
keyID String

the ID of the key

Returns:
Type
Promise

disableApiKeyByID(keyID) → {Promise}

Disable a user api key

Parameters:
Name Type Description
keyID String

the ID of the key

Returns:
Type
Promise

doSessionPost() → {Promise}

Returns an access token for the user

Returns:
Type
Promise

enableApiKeyByID(keyID) → {Promise}

Enable a user api key

Parameters:
Name Type Description
keyID String

the ID of the key

Returns:
Type
Promise

executeFunction(name, …args)

Executes a function.

Parameters:
Name Type Attributes Description
name String

The name of the function.

args * <repeatable>

Arguments to pass to the function.

executeServiceFunction(service, action, …args)

Executes a service function.

Parameters:
Name Type Attributes Description
service String

The name of the service.

action String

The name of the service action.

args * <repeatable>

Arguments to pass to the service action.

getApiKeyByID(keyID) → {Promise}

Returns a user api key

Parameters:
Name Type Description
keyID String

the ID of the key

Returns:
Type
Promise

getApiKeys() → {Promise}

Returns an array of api keys

Returns:
Type
Promise

isAuthenticated() → {Boolean}

Returns:

whether or not the current client is authenticated

Type
Boolean

linkWithProvider(providerType, optionsopt) → {Promise}

Links the currently logged in account with another account.

Parameters:
Name Type Attributes Description
providerType String

the provider of the other account (e.g. 'userpass', 'facebook', 'google')

options Object <optional>

additional authentication options

Returns:

which resolves to a String value: the original userId

Type
Promise

login(emailopt, passwordopt, optionsopt) → {Promise}

Login to stitch instance, optionally providing a username and password. In
the event that these are omitted, anonymous authentication is used.

Parameters:
Name Type Attributes Description
email String <optional>

the email address used for login

password String <optional>

the password for the provided email address

options Object <optional>

additional authentication options

Returns:
Type
Promise

logout() → {Promise}

Ends the session for the current user.

Returns:
Type
Promise

register(email, password, optionsopt) → {Promise}

Send a request to the server indicating the provided email would like
to sign up for an account. This will trigger a confirmation email containing
a token which must be used with the emailConfirm method of the userpass
auth provider in order to complete registration. The user will not be able
to log in until that flow has been completed.

Parameters:
Name Type Attributes Description
email String

the email used to sign up for the app

password String

the password used to sign up for the app

options Object <optional>

additional authentication options

Returns:
Type
Promise

service(type, name) → {Object}

Factory method for accessing Stitch services.

Parameters:
Name Type Description
type String

The service type [mongodb, {String}]

name String

The service name.

Returns:

returns a named service.

Type
Object

userProfile() → {Promise}

Returns profile information for the currently logged in user

Returns:
Type
Promise