public function postRevoke()
    {
        $oHttpCodes        = Factory::service('HttpCodes');
        $oAccessTokenModel = Factory::model('UserAccessToken', 'nails/module-auth');

        if (!isLoggedIn()) {
            throw new ApiException(
                'You must be logged in',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput       = Factory::service('Input');
        $sAccessToken = $oInput->post('access_token');

        if (empty($sAccessToken)) {
            throw new ApiException(
                'An access token to revoke must be provided',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        if (!$oAccessTokenModel->revoke(activeUser('id'), $sAccessToken)) {
            throw new ApiException(
                'Failed to revoke access token. ' . $oAccessTokenModel->lastError(),
                $oHttpCodes::STATUS_INTERNAL_SERVER_ERROR
            );
        }

        return Factory::factory('ApiResponse', 'nails/module-api');
    }
public function postRevoke()
    {
        $oHttpCodes        = Factory::service('HttpCodes');
        $oAccessTokenModel = Factory::model('UserAccessToken', 'nails/module-auth');

        if (!isLoggedIn()) {
            throw new ApiException(
                'You must be logged in',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput       = Factory::service('Input');
        $sAccessToken = $oInput->post('access_token');

        if (empty($sAccessToken)) {
            throw new ApiException(
                'An access token to revoke must be provided',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        if (!$oAccessTokenModel->revoke(activeUser('id'), $sAccessToken)) {
            throw new ApiException(
                'Failed to revoke access token. ' . $oAccessTokenModel->lastError(),
                $oHttpCodes::STATUS_INTERNAL_SERVER_ERROR
            );
        }

        return Factory::factory('ApiResponse', 'nails/module-api');
    }
public function postRevoke ( ) { $ oHttpCodes = Factory :: service ( 'HttpCodes' ) ; $ oAccessTokenModel = Factory :: model ( 'UserAccessToken' , 'nails/module-auth' ) ; if ( ! isLoggedIn ( ) ) { throw new ApiException ( 'You must be logged in' , $ oHttpCodes :: STATUS_UNAUTHORIZED ) ; } $ oInput = Factory :: service ( 'Input' ) ; $ sAccessToken = $ oInput -> post ( 'access_token' ) ; if ( empty ( $ sAccessToken ) ) { throw new ApiException ( 'An access token to revoke must be provided' , $ oHttpCodes :: STATUS_BAD_REQUEST ) ; } if ( ! $ oAccessTokenModel -> revoke ( activeUser ( 'id' ) , $ sAccessToken ) ) { throw new ApiException ( 'Failed to revoke access token. ' . $ oAccessTokenModel -> lastError ( ) , $ oHttpCodes :: STATUS_INTERNAL_SERVER_ERROR ) ; } return Factory :: factory ( 'ApiResponse' , 'nails/module-api' ) ; }
Revoke an access token for the authenticated user
@return ApiResponse
Revoke an access token for the authenticated user