Answer the question
In order to leave comments, you need to log in
How to use ajax module interface for not authorized user?
Is it even possible?
Keep getting:
errors: [{message: "Необходимо авторизоваться на сайте", code: "invalid_authentication", customData: null}]
0: {message: "Необходимо авторизоваться на сайте", code: "invalid_authentication", customData: null}
code: "invalid_authentication"
customData: null
message: "Необходимо авторизоваться на сайте"
BX.ajax.runAction("currency.format.get", {data: {currencyId: currency}})
Answer the question
In order to leave comments, you need to log in
I asked myself - I answer myself:
A set of prefilters, own for each action.
Apparently, there is some way to configure the action, through the annotation, but I did not dig that deep.
In practice, it is enough to remove the default authorization filter from an action that should work for unauthorized users. You can do this in, for example, in the init method of your controller:
protected function init()
{
parent::init();
$this->setActionConfig('apply',[
'-prefilters' => [
'\Bitrix\Main\Engine\ActionFilter\Authentication'
]
]);
}
public function applyAction()
{
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question