Closed damianoporta closed 8 years ago
Hello!
You cah find some additional information here: https://dev.1c-bitrix.ru/community/blogs/b24_marketplace/marketplace-bitriks24-how-to-make-oauth-authentication-for-desktop-app.php?commentId=70248.
Or in English: https://training.bitrix24.com/rest_help/oauth/examles.php
@yugene thank you!
@yugene You need get code first
example my code
const APPLICATION_ID = 'local.56d4c44e94a076.41291969';
const APPLICATION_SECRET = '891fb1cf1312fae25b48eccebe65c846';
const PROTOCOL = 'https';
const DOMAIN = 'supertest.bitrix24.ru';
const REDIRECT_URL = 'http://mborodov.it-master.su';
const PATH = 'https';
// получаем code и member_id если нету
if(empty($_GET['code']) || empty($_GET['member_id'])){
$params = array(
"response_type" => "code",
"client_id" => APPLICATION_ID,
"redirect_uri" => REDIRECT_URL,
);
$path = "/oauth/authorize/";
Header("HTTP 302 Found");
Header("Location: ".PATH.'://'.DOMAIN.$path."?".http_build_query($params));
die();
}
// создадим объект логгера
$log = new \Monolog\Logger('bitrix24');
$log->pushHandler(new \Monolog\Handler\StreamHandler('./bitrix24.log', \Monolog\Logger::INFO));
// создаем битрикс24 объекты
$obB24App = new \Bitrix24\Bitrix24(false, $log);
$obB24App->setApplicationScope(['task', 'entity']);
$obB24App->setApplicationId(APPLICATION_ID);
$obB24App->setApplicationSecret(APPLICATION_SECRET);
// данные пользователя
$obB24App->setDomain(DOMAIN);
$obB24App->setRedirectUri(REDIRECT_URL);
$obB24App->setMemberId($_GET['member_id']);
$obB24App->setAccessToken($obB24App->getFirstAccessToken($_GET['code'])['access_token']);
Hello, I have downloaded your library but i do not understand what data should i pass to:
Could you give me more information? Thank you!