L
L
lynnikvadim2015-04-21 13:20:26
PHP
lynnikvadim, 2015-04-21 13:20:26

How to get a Yandex token?

<?php
$yandex_get_token_url = "https://oauth.yandex.ru/token";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $yandex_get_token_url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=password&username=ЛОГИН_УЧЕТНОЙ_
ЗАПИСИ_ЯНДЕКСА&password=ПАРОЛЬ_ОТ_УЧЕТНОЙ_
ЗАПИСИ_ЯНДЕКСА&client_id=ID_ПРИЛОЖЕНИЯ&client_secret=ПАРОЛЬ_ПРИЛОЖЕНИЯ');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$token = curl_exec($ch);
curl_close($ch);
  
echo $token;

Writes an authorization error.
What could be the problem ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2015-04-21
@interlocked

https://oauth.yandex.ru/authorize?response_type=token&client_id=<идентификатор приложения>
[& display=popup]
[& state=<произвольная строка>]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question