Auth

Auth

A collection of static methods that can authenticate users to Virtru in the browser context. SDK developers might instead prefer to use the prepackaged auth widget, which leverages these methods.

For example, you can write a login page that authenticates users with federated Google identities:
Virtru.Auth.loginWithGoogle({email: 'alice@example.com', redirectUrl: 'business.html'});
   

Methods

(async, static) activateEmailCode(params)

Submit an auth code inboxed by sendCodeToEmail. This will serve to authenticate you to the Virtru platform. Can only be called in a browser.

Callers must ensure the user has been successfully logged in using isLoggedIn.
Parameters:
Name Type Description
params object [All parameters for this operation.]
Properties
Name Type Description
email string [The email address used to authenticate.]
code string [The authorization code fetched from the Virtru email prompted by #sendCodeToEmail.]
redirectUrl string [The optional url to redirect to following authentication.]

(static) isLoggedIn(params) → {boolean}

Check if a user has already been logged in, and that their credentials have not expired. Can only be called in a browser.
Parameters:
Name Type Description
params object [All parameters for this operation, including ones delegated to the oauth initializer.]
Properties
Name Type Description
email string [The email address to check if logged in.]
Returns:
- True if the email address is logged in with valid, active credentials.
Type
boolean

(async, static) loginWithGoogle(params)

Authenticate to Virtru by federating a Google account. Can only be called in a browser.
Parameters:
Name Type Description
params object [All parameters for this operation.]
Properties
Name Type Description
email string [The email address used to authenticate.]
redirectUrl string [The optional url to redirect to following authentication.]

(async, static) loginWithOffice365(params)

Authenticate to Virtru by federating an Office 365 account. Can only be called in a browser.
Parameters:
Name Type Description
params object [All parameters for this operation.]
Properties
Name Type Description
email string [The email address used to authenticate.]
redirectUrl string [The optional url to redirect to following authentication.]

(async, static) loginWithOutlook(params)

Authenticate to Virtru by federating an Outlook account. Can only be called in a browser.
Parameters:
Name Type Description
params object [All parameters for this operation.]
Properties
Name Type Description
email string [The email address used to authenticate.]
redirectUrl string [The optional url to redirect to following authentication.]

(async, static) logout(params)

Log a user out, invalidating any stored credentials. Can only be called in a browser.
Parameters:
Name Type Description
params object [All parameters for this operation.]
Properties
Name Type Description
email string [The email address used to authenticate.]

(async, static) sendCodeToEmail(params)

Request an an auth code be sent to the specified email address. Can only be called in a browser.
Parameters:
Name Type Description
params object
Properties
Name Type Description
email string [The email address to which an auth code should be sent.]