0
edits
Changes
→Общая схема работы
To get ability to use Ace Stream OAuth2, you have to register as a reseller in Ace Stream system. Resellers are able to create markets - usually, these are sites through which options are sold to users. Each market gets access to OAuth2.
==Common work scheme==
Reseller publishes on his site a link with a name like "Log in via Ace Stream", which leads here:
<nowiki>https://accounts.acestream.net/oauth/v2/auth?client_id=[CLIENT_ID]&response_type=code&redirect_uri=[REDIRECT_URI]&scope=userkey+email</nowiki>
The following parameters are inserted in the link:
* '''[CLIENT_ID]''' - market's identifier, which the reseller can find out in settings of his market
* '''[REDIRECT_URI]''' - link, to which the user will be redirected after a successful login. This link has to be listed in Redirect URI in market's settings
After following this link, the user is authorized in Ace Stream system and then redirected to the specified [REDIRECT_URI].
If during authorization an error was occurred, parameters error error_description describing the error are sent to [REDIRECT_URI].
* '''client_id''' - идентификаторmarket's маркетаidentifier
* '''client_secret''' - секретныйsecret ключmarket маркетаkey (можноyou узнатьcan вfind настйрокахit маркетаout in market's settings)
* '''code''' - кодconfirmation подтверждения,code полученныйobtained ранееearlier
* '''grant_type''' - строкаstring "authorization_code"
* '''redirect_uri''' - ссылка,link указаннаяspecified вin первомthe запросеfirst request
Response to this request is sent in JSON format.
If successful, the access token in the field <tt>access_token</tt> is sent in the response.
* '''method''' - строкаstring "getUserInfo"
* '''access_token''' - полученныйaccess ранееtoken токенobtained доступаearlier
If the request was successful, user's data in JSON format are sent in response:
<nowiki>{
"user": {