API Reference


Confirms a users username and password, and optionally returns user information.

If returnUserInfo is set to false, this method will return the user id when the settings were correct. This method always returns false when username or password is incorrect.

If login is set to true a session will be started and the system will return a sessiontoken property in the userData struct. If the returnUserInfo is false, login will be ignored.


mixed users.confirmCredentials ( int vhost, string username, string password, bool returnUserInfo = false, bool login = false, bool isEmail = false, bool isPhone = false, mixed detailedError = false, mixed mfatoken = '' )


NameTypeRequiredDefault valueDescription
vhostintRequirednoneThe id of the vhost.
usernamestringRequirednoneThe username of the user you are attempting to confirm.
passwordstringRequirednoneThe password for the user you are attempting to confirm.
returnUserInfoboolOptionalfalseIf this parameter is true it will return user info in an array as listed below
loginboolOptionalfalseIf this parameter is true it will create a user session token for the user. For this to be available you need to call the method with the returnUserInfo argument set to true.
isEmailboolOptionalfalseIf this parameter is true it will treat the username parameter as an e-mail address instead of a username string.
isPhoneboolOptionalfalseIf this parameter is true it will compare the username parameter against the phone number field instead of the username field.

Response: Optionally returned array

This is the data array that could potentially be returned if returnUserInfo is set to true

idINTThe user id for the username/email provided.
userSTRINGThe username for the account requested.
vhostINTThe vhost for the account requested.
firstnameSTRINGThe first name for the account requested.
lastnameSTRINGThe last name for the account requested.
nicknameSTRINGThe nickname for the account requested.
address1STRINGThe first line of the address for the account requested.
address2STRINGThe second line of the address for the account requested.
citySTRINGThe city for the account requested.
stateSTRINGThe state/province for the account requested.
countrySTRINGThe country for the requested account.
postalSTRINGThe postal code or zip code for the requested account.
emailSTRINGThe e-mail address for the requested account.
websiteSTRINGThe website for the requested account.
genderCHARThe gender of the requested account owner, obviously this is only going to be M for male or F for female.
phoneSTRINGThe phone number for the requested account owner.
cellphoneSTRINGThe cell phone number for the requested account owner.
occupationSTRINGThe occupation for the requested account owner.
metaSERIALIZED ARRAYAn array containing any meta data that was provided by the account owner that has been saved by the system.
newsletterBOOLWhether or not the account owner wanted the newsletter or not. 1 is true, 0 is false.

Sample Response

Sample REST Response
<?xml version="1.0" encoding="UTF-8"?>
Sample JSON Response
    "status": true,
    "result": USER_ID
Sample REST Response
<?xml version="1.0" encoding="UTF-8"?>
  <address1>1 Toronto Street</address1>

Sample JSON Response
    "status": true,
    "result": {
        "id": USER_ID,
        "user": "USER_NAME",
        "email": "USER_EMAIL",
        "firstname": "USER_FIRSTNAME",
        "lastname": "USER_LASTNAME",
        "city": "Toronto",
        "gender": "M",
        "cellphone": "4162222222",
        "phone": "4162222222",
        "website": "",
        "occupation": "",
        "address1": "1 Toronto Street",
        "address2": null,
        "state": "ON",
        "country": "CA",
        "newsletter": "0",
        "nickname": "",
        "vhost": VHOST_ID,
        "meta": {
            "lang": "en",
            "twitterUserName": "",
            "rules": "1"

Code examples


Be the first to comment on confirmCredentials.

Add a Comment

  • captcha