Authorization
Authorization takes place at every request: you need to pass the OAuth token that's generated for the Yandex account for each method in the HTTP Authorization
header.
GET api/v1 HTTP/1.1
Host: adfox.yandex.ru
Authorization: OAuth 05dd3dd84ff948fdae2bc4fb91f13e22bb1f289ceef0037
If the method was called without a token or an invalid token was passed in the request, the server returns the 401 Unauthorized
HTTP-status.
Receiving a token
To receive a token:
-
Go to the Create app page.
-
Fill out the fields:
-
Service name;
-
Service icon — optional;
-
Platforms — add one or several platforms;
-
Redirect URL — specify
https://oauth.yandex.ru/verification_code
; -
Data access — specify
adfox:api
; -
Email address — optional.
-
-
Click Create app and copy its ClientID (
).
-
Add copied ClientID to a link such as https://oauth.yandex.com/authorize?response_type=token&client_id=<идентификатор приложения>.
-
Go to the link and on the page that opens copy your authorization token.