Module: auth

Members

(static) config

Properties:
Name Type Description
config
Properties
Name Type Attributes Default Description
loginUrl String <optional>
"/login" The URL called by login().
logoutUrl String <optional>
"/logout" The URL called by logout().
modelId String <optional>
"me" The id for the user model.
ignoreServerModelId Boolean <optional>
false Force the module to use the configured modelId to fetch and store the user model.
useOAuth Boolean <optional>
false Use OAuth method to authenticate.
oAuthAccessTokenURL String <optional>
"/oauth/access_token" OAuth endpoint to retrieve access token.
oAuthClientID String <optional>
"app" OAuth client ID
oAuthClientSecret String <optional>
"secret" OAuth client secret.
useTouchID Boolean <optional>
false Use TouchID to protect stored/offline login.
enforceTouchID Boolean <optional>
false If true, disable the stored/offline login when TouchID is disabled or not supported.
useTouchIDPromptConfirmation Boolean <optional>
false Ask the user if he wants to use the TouchID protection after the first signup. If false, the TouchID protection is used without prompts.
Source:

(static) OAuth :Object

OAuth object instance of oauth module
Type:
  • Object
Source:
See:
  • support/oauth

Methods

(static) authenticateViaTouchID(success, error)

Authenticately via TouchID.
Parameters:
Name Type Description
success function The callback to call on success.
error function The callback to call on error.
Source:

(static) autoLogin(opt, opt)

This method will select the best behaviour and will login the user
Parameters:
Name Type Description
opt Object
opt Object
Properties
Name Type Attributes Default Description
silent Boolean <optional>
false Silence all global events
success function <optional>
null The success callback to invoke
error function <optional>
null The error callback to invoke
timeout function <optional>
10000 Timeout after the auto login will cause an error
Source:

(static) event()

Add an event to current module
Source:

(static) getUser() → {Backbone.Model}

Get current User model
Source:
Returns:
Type
Backbone.Model

(static) getUserID() → {Number}

Get current User ID Return 0 if no user is logged in
Source:
Returns:
Type
Number

(static) isLoggedIn() → {Boolean}

Check if the user is logged in
Source:
Returns:
Type
Boolean

(static) isOfflineLoginAvailable() → {Boolean}

Check if an offline login is available
Source:
Returns:
Type
Boolean

(static) isStoredLoginAvailable() → {Boolean}

Check if the stored login feature is available Stored login indicate if the auth can be completed using stored credentials on the device but require an Internet connection anyway
Source:
Returns:
Type
Boolean

(static) isTouchIDSupported() → {Boolean}

Check if the TouchID is enabled and supported on the device and configuration.
Source:
Returns:
Type
Boolean

(static) loadDriver() → {Object}

Load a driver
Source:
Returns:
Type
Object

(static) login(opt)

Login using selected driver
Parameters:
Name Type Description
opt Object
Properties
Name Type Attributes Default Description
silent Boolean <optional>
false Silence all global events
driver String <optional>
"bypass" The driver to use as string
success function <optional>
null The success callback to invoke
error function <optional>
null The error callback to invoke
Source:

(static) logout(callback)

Logout the user
Parameters:
Name Type Description
callback function Callback to invoke on completion
Source:

(static) offlineLogin(opt)

Login using offline properties This method doesn't require an internet connection
Parameters:
Name Type Description
opt Object
Properties
Name Type Attributes Default Description
silent Boolean <optional>
false Silence all global events
success function <optional>
null The success callback to invoke
error function <optional>
null The error callback to invoke
Source:

(static) storedLogin(opt)

Login using stored credentials on the device
Parameters:
Name Type Description
opt Object
Properties
Name Type Attributes Default Description
silent Boolean <optional>
false Silence all global events
success function <optional>
null The success callback to invoke
error function <optional>
null The error callback to invoke
Source:

(static) userWantsToUseTouchID(val) → {Boolean}

Set or get the TouchID use property.
Parameters:
Name Type Description
val Boolean
Source:
Returns:
Type
Boolean