onymosAccess.login
To authenticate the user using one of the leading social authentication (OAuth 2.0) providers.
function socialLogin (authProvider) {
var accessObj = {
authProvider: authProvider
};
OnymosAccess.login(
accessObj,
function loginSuccess (statusMessage) {
console.log(statusMessage);
// Optionally, call getAuth to get authData
var authDataObject = OnymosAccess.getAuth();
},
function loginFailure (error) {
console.log(error);
},
options);
} /* end function socialLogin */
String
The name of the social authentication provider (e.g., ‘apple’, ‘facebook’, ‘google’, etc).
Object
An object with the property authProvider.
{
authProvider: string // one of ‘apple’, ‘facebook’, or ‘google’
}
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:
- Additional permissions will reduce the number of users logging into your app.
- 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.
function socialLogout() {
OnymosAccess.logout(
function logoutSuccess (statusMessage) {
console.log(statusMessage);
},
function logoutFailure (error) {
console.log(error);
});
} /* end function socialLogout */
onymosAccess.getAuth
To obtain the authentication details of the logged-in user.
function getAuth() {
var authObject = OnymosAccess.getAuth();
/* ------
authObject = {
authProvider: Authentication Provider : 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.
------ */
} /* end function getAuth */
onymosAccess.listenForAuth
To set a Callback function that will be invoked when a session authenticates or de-authenticates.
function authCallbackFunction(authData) {
if (authData) {
console.log('User : ' + authData.userName + ' is logged in.');
}
else {
console.log('User has logged out.');
}
} /* end function authCallbackFunction */
OnymosAccess.listenForAuth(authCallbackFunction);
onymosAccess.stopListenForAuth
Remove all Callback functions that were setup to listen to Auth changes.
function stopAuthCallbacks() {
OnymosAccess.stopListenForAuth();
} /* end function stopAuthCallbacks */
onymosAccess.getOtherUsersInfo
To obtain information about users of the app, other than the logged-in user.
function getOtherUsersInfo() {
OnymosAccess.getOtherUsersInfo(
function getOtherUsersInfoSuccess (userInfoRecords) {
/* ------
userInfoRecords[] = {
userId: unique_user_id,
userName: username,
userPhoto: user_photo_url
}; ------ */
},
function getOtherUsersInfoFailure (error) {
console.log(error);
},
options);
} /* end function getOtherUsersInfo */
string
Search for users with userName starting with searchString provided.
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.
function signUp (authProvider, email, password, phone) {
var signupParamsObject = {
authProvider: authProvider,
userEmail: email,
userPassword: password,
userPhone: phone
};
OnymosAccess.signUp(
signupParamsObject,
function signUpSuccess (statusMessage) {
console.log(statusMessage);
},
function signUpFailure (error) {
console.log(error);
});
} /* end function signUp */
String
Should be ‘account’ when using Onymos Hosting or your own cloud database.
String
The user’s email address.
String
The user’s password.
String
The user’s phone number.
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.
function resetPasswordRequest (authProvider, email) {
var passwordResetParamsObject = {
authProvider: authProvider,
userEmail: email,
};
OnymosAccess.sendPasswordResetEmail(
passwordResetParamsObject,
function sendPasswordResetEmailSuccess (statusMessage) {
console.log(statusMessage);
},
function sendPasswordResetEmailFailure (error) {
console.log(error);
});
} /* end function resetPasswordRequest */
String
Should be ‘account’ when using Onymos Hosting or your own cloud database.
String
The user’s email address.
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.
function resetPassword (authProvider, email, oldPw, newPw) {
var passwordResetParamsObject = {
authProvider: authProvider,
userEmail: email,
oldPassword: oldPw,
newPassword: newPw
};
OnymosAccess.resetPassword(
passwordResetParamsObject,
function resetPasswordSuccess (statusMessage) {
console.log(statusMessage);
},
function resetPasswordFailure (error) {
console.log(error);
});
} /* end function resetPassword */
String
Should be ‘account’ when using Onymos Hosting or your own cloud database.
String
The user’s email address.
String
The user’s current password.
String
The user’s new password.
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 days or weeks off your development timeline.