Ich möchte auf MS Cloud API auf Android Flatform zugreifen.Zugriff auf MS Cloud-API nicht möglich
So fand ich eine Beispielanwendung.
Hier ist Beispiel App, die diese Funktion arbeiten. (https://github.com/adithya321/Companion-for-Band/blob/dev/app/src/main/java/com/pimp/companionforband/activities/cloud/WebviewActivity.java)
Ich habe MS Anwendung von dev.app.microsoft.com
und Passwort gemacht und Web-Plattform rediret uri registrieren (https://login.live.com/oauth20_desktop.srf)
So hatte ich meine client_id, client_serect
In der Funktion downloreUrl ist RequestMethod "GET". Also habe ich es in "POST" geändert.
private String downloadUrl(String url) throws IOException {
InputStream is = null;
try {
URL u = new URL(url);
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.connect();
is = conn.getInputStream();
return readIt(is, 9999);
} finally {
if (is != null) {
is.close();
}
}
aber es funktioniert nicht diese App.
Ich änderte Zugriffsmethode mit HttpClient, nicht HttpURLConnection.
Ich habe festgestellt, dass ich auf MS Cloud API mit öffentlichen Client zugreifen.
hier ist logcat
02-10 15:30:51.533 29336-29639/com.example.user.bandsample D/WebviewActivity: executeClient: {"error":"invalid_request","error_description":"Public clients can't send a client secret."}
löschen client_secret, ich habe gerade ohne Aktualisierungs-Token access_token.
Ich weiß nicht, was ich tun soll.