To authenticate the user you need to redirect his or her browser to http://developers.cityads.com/auth/, using application/x-www-form-urlencoded data format
|client_id||CityAds user ID, which implements the OAuth authorization;|
|redirect_uri||the address to which the user will be redirected after authentication;|
|response_type||type of response required. Now always – code;|
If the user is not logged on the website, he or she will be prompted in a dialog box to enter their username and password.
After a successful authorization of the application the user will be redirected to redirect_uri, as stated at the authorization dialogue opening. The code for c0de access key will be sent to the GET-parameter to the address
If an error occurs, the user's browser will show the authentication form with the text of such error (test layout in the example).
To get access_token it is necessary to make POST query to http://developers.cityads.com/auth/token/, using application/x-www-form-urlencoded data format
|client_secret||secret key of the partner that you can get in the personal account;|
|code||the code obtained at the previous authorization stage;|
|grant_type||type of query – authorizationCode.|
|redirect_uri||the address to which the user will be redirected after authentication.|
As a result of this query the user will receive access_token.
accessToken = remote_auth and it's used in every API request.