Account functions (Core)

Below is the account functionality included in the SDK core. All functions resides in the namespace Boka.account and should be prefixed as such.

get()

Description:

The get() command is used to retrieve all information about the authenticated user.

Usage:

Boka.account.get(callback);

Where callback is a function called with a return callback parameter containing the following user data.

Response:

Key Data type Value
Id string Unique identifier.
UserName string First and last name.
Email string E-mail address.
CompanyName string Company name.
Mobile string Mobile phone number.
UserType number Integer indicating type of user. 1 for private, 2 for company, 3 for association.
OrganizationNumber string Organization number.
DateOfBirth string Birth date.
Address1 string First address field.
Address2 string Second address field.
ZipCode string Zip code of address.
City string City of address.
Providers array[] Array of names indicating other login providers connected to the account, such as Facebook or Google.

Example:

Boka.account.get(function (userData) {
    console.log('What is the weather like in ' + userData.result.City + '?');
});

isAuthed()

Description:

The isAuthed() returns a boolean indicating whether or not a user is currently authenticated to your site.

Usage:

Boka.account.isAuthed();

Example:

if (Boka.account.isAuthed()) {
    console.log('I\'m in!');
}