User invalid er

I am setting up a custom api route using annotations and I am just getting a User invalid when accessing this endpoint:

/api/document?apikey=8cc545dc5634bd896569cae7b0b5ac6128a6a6d311c559ae559783e5251d8e0b

The key is valid because I can get data from the pimcore webservice with it.

Here is the code of my controller handling the request and a screenshot of the error - it never seems to fire as the var_dump never happens. I get a 403 error from the system stating the User is invalid

namespace AppBundle\Controller\Admin;

use Pimcore\Bundle\AdminBundle\Controller\Rest\AbstractRestController;
use Pimcore\Model\Document;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;

class DocumentApiController extends AbstractRestController
{

    /**
     * @Route("/api/document", name="hdmz_api_document", methods={"POST"})
     *
     */
    public function documentAction(Request $request)
    {
        var_dump('here we are'); exit;
    }
}

Hi @justbane,

Does it work if you change the route to something like /webservice/api/document. As far as I know the webservice authenticator only works on routes beginning with /webservice. See https://github.com/pimcore/pimcore/blob/master/bundles/CoreBundle/Resources/config/pimcore/security.yml#L46-L52

Hope this helps!

1 Like

Bingo, that was it. Thanks!!