Array
(
[error] => WRONG_AUTH_TYPE
[error_description] => Current authorization type is denied for this method
)
i´m trying to create an event that triggers when a call starts and it should work for all users, not the ones with admin previleges but even i that have admin privileges get this error so i guess it does not have anything to do with it? this is the error i get when i run my event handler, i´m new to this so i don´t actually know how the authorization works, i´ve read the documentation but haven´t reached any solutions yet.
handler.php:
<?php
require_once (__DIR__.'/crest.php');
class AuthSimple
{
const AUTH_TYPE = 'demo_simple';
const AUTH_PARAM_NAME = 'secret_word';
const AUTH_PARAM_VALUE = 'MySuperSecurePassword123456';
public static function onRestCheckAuth(array $query, $scope, &$res)
{
if(array_key_exists(static::AUTH_PARAM_NAME, $query))
{
$res = array('error' => 'INVALID_CREDENTIALS', 'error_description' => 'Invalid request credentials');
return false;
}
return null;
}
}
$data = file_get_contents('https://gotmink.bitrix24.com.br/rest/4755/uj3p50inofwg6eqm/');
echo '<PRE>';
$result = CRest::call(
'event.bind',
[
'event' => 'OnVoximplantCallInit',
'handler' => 'https://testebitrix24.herokuapp.com/handler.php',
'auth_type' => '4755',
'event_type' => 'online'
]
);
print_r($result);
echo '</PRE>';
?>