onymos-logo

onymosAccess.login

To authenticate the user using one of the leading social authentication (OAuth 2.0) providers.

OnymosAccess.login(
{
authProvider: authProvider
};
(data) => {
console.log(data);
},
(error) => {
console.log(error);
},
options
);
authProvider

String

The name of the social authentication provider (e.g., ‘apple’, ‘facebook’, ‘google’, etc).

accessObject

Object

An object with the property authProvider.

{
authProvider: string // one of ‘apple’, ‘facebook’, or ‘google’
}
options
Scope

String

Additional requested permissions from the social authentication providers.
Facebook: Comma-separated list as described here.
Google: Space-separated list as described under “Google Sign-In” here.

Note:

  1. Additional permissions will reduce the number of users logging into your app.
  2. Some permissions might require review from the authentication provider. Please contact Onymos support to request such additional permissions.

Example:

var options = {
scope: ‘public_profile, email’ // Facebook comma-separated
};
var options = {
scope: ‘profile email’ // Google space-separated
};

onymosAccess.logout

To de-authenticate the logged-in user.

OnymosAccess.logout(
(statusMessage) => {
console.log(statusMessage);
},
(error) => {
console.log(error);
}
);

onymosAccess.getAuth

To obtain the authentication details of the logged-in user.

const authObject = OnymosAccess.getAuth();
/* ------
authObject = {
authProvider: e.g., 'apple', 'facebook', or 'google',
userId: Unique ID of authenticated user, if available,
userName: Name of logged-in user,
userPhoto: URL to photo of logged-in user, if available,
nativeAuth: Object with additional authentication provider details
};
Returns NULL if session is not authenticated.
------ */
Note: This is a synchronous call.

onymosAccess.listenForAuth

To set a Callback function that will be invoked when a session authenticates or de-authenticates.

authCallBackFunction(authData) {
if (authData) {
console.log('User : ' + authData.userName + ' is logged in.');
} else {
console.log('User has logged out.');
};
};

OnymosAccess.listenForAuth(authCallBackFunction);

Note: This is a synchronous call.

onymosAccess.stopListenForAuth

Remove all Callback functions that were setup to listen to Auth changes.

OnymosAccess.stopListenForAuth();
Note: This is a synchronous call.

onymosAccess.getOtherUsersInfo

To obtain information about users of the app, other than the logged-in user.

OnymosAccess.getOtherUsersInfo(
(userInfoRecords) => {
/* ------
userInfoRecords = [{
userId: Unique user ID,
userName: Username,
userPhoto: User photo URL
}];
------ */
},
(error) => {
console.log(error);
},
options
);
options
searchString

string

Search for users with userName starting with searchString provided.

numberOfRecords

string

The number of userRecords you want returned in this function.

onymosAccess.signup

To register the user when you are using Onymos Hosting or your own cloud database.

OnymosAccess.signup(
{
authProvider: authProvider,
userEmail: email,
userPassword: password,
userPhone: phone
},
(statusMessage) => {
console.log(statusMessage);
},
(error) => {
console.log(error);
}
);
authProvider

String

Should be ‘account’ when using Onymos Hosting or your own cloud database.

userEmail

String

The user’s email address.

userPassword

String

The user’s password.

userPhone

String

The user’s phone number.

signupParamsObject

Object

An object with authProvider, userEmail, userPassword, and userPhone properties.

{
authProvider: string // 'account'
userEmail: string // user's email
userPassword: string // user's password
userPhone: string // user's phone
}

onymosAccess.resetPasswordRequest

For the user to request to reset their password when using Onymos Hosting or your own cloud database.

OnymosAccess.resetPasswordRequest(
{
authProvider: authProvider,
userEmail: email,
};
(statusMessage) => {
console.log(statusMessage);
},
(error) => {
console.log(error);
}
);
authProvider

String

Should be ‘account’ when using Onymos Hosting or your own cloud database.

userEmail

String

The user’s email address.

passwordResetParamsObject

Object

An object with authProvider and userEmail properties.

{
authProvider: string // 'account'
userEmail: string // user's email
}

onymosAccess.resetPassword

To reset the user’s password when using Onymos Hosting or your own cloud database.

OnymosAccess.resetPassword(
{
authProvider: authProvider,
userEmail: email,
oldPassword: oldPw,
newPassword: newPw
};
(statusMessage) => {
console.log(statusMessage);
},
(error) => {
console.log(error);
}
);
authProvider

String

Should be ‘account’ when using Onymos Hosting or your own cloud database.

userEmail

String

The user’s email address.

oldPassword

String

The user’s current password.

newPassword

String

The user’s new password.

resetPasswordParamsObject

Object

An object with authProvider, userEmail, oldPassword, and newPassword properties.

{
authProvider: string // 'account'
userEmail: string // user's email
oldPassword: string // user's old password
newPassword: string // user's new password
}

Think differently about app development

Download our free white paper today to learn how Onymos Features can maximize the value of your developer resources — and shave weeks or months off your development timeline.

Get your free white paper

Overlay