TwistPHP Documentation

_auth

File path: dist/twist/Core/Controllers/BaseRESTUser.controller.php
Namespace: Twist\Core\Controllers
Extends: BaseRESTKey

_authAn extension of BaseRest->_auth to determine if the request is a logged in user, if so validate the auth token otherwise try to log the user in.
A valid auth key and IP address is still required here, Failure to get a valid user session will terminate the request here, the controller function will not be run

Return Values

void — No return information has been documented for this function.

Example

<?php
/** --------- Option 1 --------- */

//Register a dynamic route that will direct all function requests to the controller
Twist::Route() -> controller('/baserestuser%','\Twist\Core\Controllers\BaseRESTUser');

/** --------- Option 2 --------- */

//Or you can register a route to only direct the current request to a particular controller method
Twist::Route() -> get('/baserestuser/_auth',array('\Twist\Core\Controllers\BaseRESTUser','_auth'));