Aurora Corporate documentation

Logging in programmatically

If you have some existing web application, you might want to integrate Aurora Corporate into it. It is possible to send authentication data from your application into Aurora Corporate bypassing its login screen.

In order to make use of Aurora Corporate API, you'll need to initialize it as follows:

include __DIR__.'/../system/autoload.php';

It is assumed that the code itself is located in a subdirectory of main Aurora Corporate directory. If that's not the case, you'll need to adjust the filesystem path which points to autoload.php file. And of course, you can supply full filesystem path there, e.g.:

include '/var/www/html/aurora/system/autoload.php';

In order to log specified user into their email account, Login method of Core module is used. It takes 2 parameters: email address and account password.

Below, please find sample code for logging a particular user into Aurora Corporate. For the sake of simplicity, email and password are supplied directly in the code. In actual application, they will probably be taken from session, POST data, etc.

$sUserLogin = "";
$sUserPassword = "MyPassWord";
include __DIR__.'/../system/autoload.php';
$aData = \Aurora\System\Api::GetModuleDecorator('Core')->Login($sUserLogin, $sUserPassword);
if (isset($aData['AuthToken']))
    $sAuthToken = $aData['AuthToken'];
    setcookie('AuthToken', $sAuthToken, time()+3600, "/");

Note the line with Api::Location method call. Upon logging user into their account, Aurora Corporate interface needs to be opened, and this line does that. Once again, it's assumed that the code itself is located in a subdirectory of main Aurora Corporate directory. You can supply absolute or relative URL (NOT the path) pointing to your Aurora Corporate installation there.

Also note that "/" stands for cookie path which should point to the installation folder. If you have Aurora Corporate set up in subfolder of the domain, e.g. then you need to adjust the path accordingly:

setcookie('AuthToken', $sAuthToken, time()+3600, "/aurora/");

In general, logging in programmatically and logging in using main Aurora Corporate page use the same idea:

  • If the account with that email address exists, user will be logged into it.

  • If the account doesn't exist in Aurora Corporate yet, and the matching domain is found in Mail Servers list in admin interface, account will be created according to incoming/outgoing mail settings for that domain, and then user will be logged into that account.