XF 2.0 Getting value from route parameter (ParameterBag / action problems...)

I'm trying to get a value from the URL.

Route set up as follows:

Screen Shot 2017-10-08 at 18.06.21.png

This is the action code:

  public function actionIndex(ParameterBag $params)
    echo "<pre>";
    echo "</pre>";

    return $this->message('Hello world!');
if I visit http://DOMAIN/authenticate but if I add on a value, e.g. http://DOMAIN/authenticate/1234567890, then it seems to be looking for an action matching the token.

(Code: invalid_action, controller: IPSE\Authenticate:Authenticate, action: 1234567890)

I don't understand what I'm missing...
Last edited:

Chris D

XenForo developer
Staff member
It needs a trailing slash, e.g. http://DOMAIN/authenticate/1234567890/.

That helps the routing system distinguish between a URL with a parameter and a URL with an action.

From a development point of view it's just one of those things you'll learn to remember, but from a user perspective, it will go unnoticed (the XF link builder will always build the correct link).