我的REST請求看起來像這樣後,我通過這個指南閱讀:How to Authorize to Microsoft Azure-ADAzure的AD的OAuth 2.0代碼進行授權與Java新澤西
Client cli = ClientBuilder.newClient();
WebTarget webTar = cli.target("https://login.microsoftonline.com/yyyyy.onmicrosoft.com/oauth2/authorize").queryParam("response_type", "code");
webTar = webTar.queryParam("client_id", "ed4d67dc-34a8-4eb3-9058-49f39yyyyyy");
webTar = webTar.queryParam("redirect_uri", URLEncoder.encode("https://xyxyxyx.onmicrosoft.com/o365jso", "UTF-8"));
String response = webTar.request(MediaType.APPLICATION_JSON).get(String.class);
但是我收到一個完整的HTML作爲響應,這得出結論端點認爲我是一個瀏覽器。有沒有辦法以某種方式正確地進行(以授權方的URL的形式)接收授權碼,然後訪問令牌爲Sharepoint/Exchange事後與Java澤西?