Answer the question
In order to leave comments, you need to log in
How to send a correct POST request??
To get a token for Yandex.disk, in theory, you need to send a Post request to the address:
https://oauth.yandex.ru/authorize?" +"response_type="+response_type+"&client_id="+client_id.>
https://oauth.yandex.ru/verification_code#access_token=<токен>&token_type=bearer&expires_in=<время жизни>
HttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost("https://oauth.yandex.ru/authorize?" +
"response_type="+response_type+
"&client_id="+client_id);
HttpResponse response;
response = httpClient.execute(post);
post.abort();
}
Answer the question
In order to leave comments, you need to log in
You didn't read the docs well . We need not a post-request, but to direct the user to a page at a specific address. Apparently, you write something for android. So, they also indicate how to process a token on a mobile phone.
In general:
1) When you send a post, then all the data must be in the request body, and not in the URL parameters. Take a closer look at the docks: get-requests are formed there via URL, headers and other things are specified for post-requests. It's hard to confuse them.
2) Forming a URL with parameters manually is very bad. For such purposes, there is this . And in general, the string must be formed through the builder .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question