我是否想为我的应用获取刷新令牌。通过使用以下网址 https://login.microsoftonline.com/7344cc05-d076-432a-93b7-b2718765a6e3/oauth2/authorize?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080/auth/azureoauth/callback/client_id=1c1b7a0c-39ad-4ec8-a802-b31fff5af9a9
文档https://graph.microsoft.io/en-us/docs/authorization/app_authorization中的它表示这将返回200 OK响应但对我来说它返回了一些我无法理解的html格式响应
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html class="win-hoverable" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" style="background-color: rgb(0, 114, 198);" lang="iv" xml:lang="iv">
<head>
<title>Error</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="PageID" content="i5030.2.0" />
<meta name="SiteID" content="501148" />
<meta name="ReqLC" content="1033" />
<meta name="LocLC" content="1033" />
<meta name="mswebdialog-newwindowurl" content="*" />
<script type="text/javascript">//<![CDATA[$Config={"scid":1013,"hpgact":1800,"hpgid":1,"apiCanary":"AQABAAAAAADRNYRQ3dhRSrm-4K-adpCJghA7VMBwzPSjthwdQJNluIXFGP9g0R6sZ1ExlGiycR1vtLQbHry4HDmy9GXA8-gmA2C-j1fYWiIzdvWWqXixjdI1TqlIKkmIZ_X5mrCMnW1HmxjVEBBLXzMuPViWDZydZsyDbzJY6XlU7HAN6VyNt7IwK-3jvr_2p_Tobqc7ZCZ_ThLE9SqxSKB9s-0PfSknmxtkoGV_Yged7Aijp0_5uCAA","canary":"GSvrZPc8U7fhoeGBAal8D72VCIc3e9Ib53z2bpi9qbc=5:1","correlationId":"e55594f0-a426-4570-be69-73bada74d564","locale":{"mkt":"en-US","lcid":1033},"strings":{"onprempasswordvalidation":{"authenticatingmessage":"Trying to sign you in","timeouterrormessage":"We didn\u0027t receive a response. Please try again.","genericerrormessage":"Something went wrong. Try again in a few minutes. If this doesn\u0027t work, contact your admin."},"mfa":{"setitupnow":"Set it up now"}},"enums":{"ClientMetricsModes":{"None":0,"SubmitOnPost":1,"SubmitOnRedirect":2,"InstrumentPlt":4}},"urls":{"instr":{"pageload":"https://login.microsoftonline.com/common/instrumentation/reportpageload","dssostatus":"https://login.microsoftonline.com/common/instrumentation/dssostatus"}},"browser":{"ltr":1,"_Other":1,"Full":1,"RE_Other":1,"b":{"name":"Other","major":-1,"minor":-1},"os":{"name":"Unknown","version":""},"V":-1},"watson":{"enabled":true,"url":"/common/handlers/watson","bundle":"https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/cdnbundles/watson.min.js","sbundle":"https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/cdnbundles/watsonsupport.min.js","resetErrorPeriod":5,"maxCorsErrors":2,"maxInjectErrors":5,"maxErrors":10,"maxTotalErrors":100,"incScripts":true,"expSrcs":["https://secure.aadcdn.microsoftonline-p.com/ests/","https://login.microsoftonline.com",".login.microsoftonline.com"]},"serverDetails":{"slc":"ProXXXXes","dc":"SIN2","ri":"ESTXXXX_14","ver":{"v":[2,1,5482,5]},"rt":"2017-02-13T06:43:45"}};//]]>
</script>
<script type="text/javascript">//<![CDATA[!function(){function r(r,o,a){function u(){var r=!!i.method,e=r?i.method:a[0],u=i.extraArgs||[],s=t.$WebWatson;try{var l=n(a,!r);if(u&&u.length>0)for(var c=u.length,f=0;c>f;f++)l.push(u[f]);e.apply(o,l)}catch(g){return void(s&&s.submitFromException&&s.submitFromException(g))}}var i=e.r&&e.r[r];return o=o?o:this,i&&(i.skipTimeout?u():t.setTimeout(u,0)),i}function n(r,n){return Array.prototype.slice.call(r,n?1:0)}var t=window;t.$Do||(t.$Do={q:[],r:[],removeItems:[],lock:0});var e=t.$Do;e.when=function(n,t){var o=0,a=[],u=1,i="function"==typeof t;i||(o=t,u=2);for(var s=u;s<arguments.length;s++)a.push(arguments[s]);r(n,o,a)||e.q.push({id:n,c:o,a:a})},e.register=function(n,t,o){if(!e.r[n]){var a={};if(t&&(a.method=t),o&&(a.skipTimeout=o),arguments&&arguments.length>3){a.extraArgs=[];for(var u=3;u<arguments.length;u++)a.extraArgs.push(arguments[u])}e.r[n]=a,e.lock++;try{for(var i=0;i<e.q.length;i++){var s=e.q[i];s.id==n&&r(n,s.c,s.a)&&e.removeItems.push(s)}}catch(l){throw l}finally{if(e.lock--,0===e.lock){for(var c=0;c<e.removeItems.length;c++)for(var f=e.removeItems[c],g=0;g<e.q.length;g++)if(e.q[g]===f){e.q.splice(g,1);break}e.removeItems=[]}}}},e.unregister=function(r){e.r[r]&&delete e.r[r]}}(),function(){function r(r,n,t){var e=m.createElement("script");e.id=n,e.setAttribute("crossorigin","anonymous"),e.type="text/javascript",e.setAttribute("src",r),e.defer=!1,e.async=!1,e.onload=t,e.onerror=o,e.onreadystatechange=function(){"loaded"===e.readyState?setTimeout(t,500):"complete"===e.readyState&&t()};var a=m.getElementsByTagName("head")[0];a.appendChild(e),d.$Debug&&d.$Debug.appendLog("[WebWatson]: Loading Script '"+(r||"")+"', id:"+(n||""))}function n(){var n=p.bundle;p.bundle=null,delete p.bundle,r(n,"WebWatson_DemandLoaded",e)}function t(){$||(d.jQuery?n():r(p.sbundle,"WebWatson_DemandSupport",n),p.sbundle&&(p.sbundle=null,delete p.sbundle),$=!0)}function e(){if(d.$WebWatson){if(d.$WebWatson.isProxy)return void o();b.when("$WebWatson.full",function(){for(;W.length>0;){var r=W.shift();r&&d.$WebWatson[r.cmdName].apply(d.$WebWatson,r.args)}})}}function o(){var r=d.$WebWatson?d.$WebWatson.isProxy:!0;a(),p.loadErrorUrl&&r&&window.location.assign(p.loadErrorUrl)}function a(){W=[],d.$WebWatson=null}function u(r){return function(){var n=arguments;W.push({cmdName:r,args:n}),t()}}function i(){var r=["foundException","resetException","submit","submitFromException","showError","reportException"],n=this;n.isProxy=!0;for(var t=r.length,e=0;t>e;e++){var o=r[e];o&&(n[o]=u(o))}}function s(r,n,t,e,o,a,u,i,s){var l=d.event;a||(a=v(o||l,u?u+2:2)),d.$Debug&&d.$Debug.appendLog("[WebWatson]:"+(r||"")+" in "+(n||"")+" @ "+(t||"??")),w.submit(r,n,t,e,o||l,a,u,i,s)}function l(r,n){return{signature:r,args:n,toString:function(){return this.signature}}}function c(r){for(var n=[],t=r.split("\n"),e=0;e<t.length;e++)n.push(l(t[e],[]));return n}function f(r){for(var n=[],t=r.split("\n"),e=0;e<t.length;e++){var o=l(t[e],[]);t[e+1]&&(o.signature+="@"+t[e+1],e++),n.push(o)}return n}function g(r){if(!r)return null;try{if(r.stack)return c(r.stack);if(r.error){if(r.error.stack)return c(r.error.stack)}else if(window.opera&&r.message)return f(r.message)}catch(n){}return null}function v(r,n){var t=[];try{for(var e=arguments.callee;n>0;)e=e?e.caller:e,n--;for(var o=0;e&&y>o;){var a="InvalidMethod()";try{a=e.toString()}catch(u){}var i=[],s=e.args||e.arguments;if(s)for(var c=0;c<s.length;c++)i[c]=s[c];t.push(l(a,i)),e=e.caller,o++}}catch(u){t.push(l(u.toString(),[]))}var f=g(r);return f&&(t.push(l("--- Error Event Stack -----------------",[])),t=t.concat(f)),t}var d=window,m=d.document,h=d.$Config||{},p=h.watson,b=d.$Do;if(!d.$WebWatson&&p&&p.enabled){var W=[],$=!1,y=10,w=d.$WebWatson=new i;w.CB={},w._orgErrorHandler=d.onerror,d.onerror=s,w.errorHooked=!0,b.when("jQuery.version",function(r){p.expectedVersion=r}),b.register("$WebWatson")}}(),function(){function r(r,n){for(var t=n.split("."),e=t.length,o=0;e>o&&null!==r&&void 0!==r;)r=r[t[o++]];return r}function n(n){var t=null;return null===s&&(s=r(a,"Constants")),null!==s&&n&&(t=r(s,n)),null===t||void 0===t?"":t.toString()}function t(t){var e=null;return null===u&&(u=r(a,"$Config.strings")),null!==u&&t&&(e=r(u,t.toLowerCase())),(null===e||void 0===e)&&(e=n(t)),null===e||void 0===e?"":e.toString()}function e(r,n){var e=null;return r&&n&&n[r]&&(e=t("errors."+n[r])),e||(e=t("errors."+r)),e||(e=t("errors."+l)),e||(e=t(l)),e}function o(t){var e=null;return null===i&&(i=r(a,"$Config.urls")),null!==i&&t&&(e=r(i,t.toLowerCase())),(null===e||void 0===e)&&(e=n(t)),null===e||void 0===e?"":e.toString()}var a=window,u=null,i=null,s=null,l="GENERIC_ERROR";a.GetString=t,a.GetErrorString=e,a.GetUrl=o}(),function(){var r=window,n=r.$Config||{};r.$B=n.browser||{}}();//]]>
</script>
<script crossorigin="anonymous" src="https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/cdnbundles/jquery.1.11.min.js"/>
<link rel="SHORTCUT ICON" href="https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/images/favicon_a.ico" />
<link href="https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/cdnbundles/login.min.css" rel="stylesheet" />
<script crossorigin="anonymous" src="https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/cdnbundles/aad.login.min.js"/>
<script type="text/javascript"> if (navigator.userAgent.match(/IEMobile\/10\.0/)) { var msViewportStyle = document.createElement("style"); msViewportStyle.appendChild( document.createTextNode( "@-ms-viewport{width:auto!important}" ) ); msViewportStyle.appendChild( document.createTextNode( "@-ms-viewport{height:auto!important}" ) ); document.getElementsByTagName("head")[0].appendChild(msViewportStyle); } </script>
</head>
<body>
<div id="background_branding_container" class="ie_legacy" style="background-color: rgb(0, 114, 198); background-position: initial; background-repeat: initial;">
<img id="background_background_image" style="width: 886px; height: 678px; background-color: rgb(0, 114, 198); visibility: visible;" src="https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/images/default_signin_illustration.png" />
</div>
<div id="login_panel" class="login_panel" style="display: block;">
<table class="login_panel_layout" style="height: 100%;">
<tbody>
<tr class="login_panel_layout_row" style="height: 100%;">
<td id="login_panel_center">
<script type="text/javascript"> $(document).ready(function () { User.UpdateLogo('', 'Sign In'); User.UpdateBackground('https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5482.5/content/images/default_signin_illustration.png', ''); }); </script>
<div class="login_inner_container" style="display: block;">
<div class="inner_container cred">
<div class="login_workload_logo_container"/>
<div class="spacer"/>
<div id="login_error_container" class="login_error_container"/>
<div class="login_cta_container normaltext">
<div id="login_cta_text" class="cta_message_text 1"> Sorry, but we’re having trouble signing you in. <p>We received a bad request.</p> <p/>
</div>
</div>
<ul class="login_cred_container">
<li class="login_cred_options_container">
<div id="recover_container" class="subtext smalltext" style="visibility: visible; opacity: 1;">
<span> </span>
</div>
</li>
</ul>
</div>
<div class="push"/>
</div>
<div id="footer_links_container" class="login_footer_container">
<div id="error_details_container" class="tinytext" style="visibility: visible; opacity: 1; color: #808080; margin-top: -150px">
<table style="width: 100%">
<tr>
<td>Additional technical information:</td>
</tr>
<tr>
<td>Correlation ID: e55594f0-a426-4570-be69-73bada74d564</td>
</tr>
<tr>
<td>Timestamp: 2017-02-13 06:43:45Z</td>
</tr>
<tr>
<td id="service_exception_message" >AADSTS90014: The request body must contain the following parameter: 'client_id'.</td>
</tr>
<tr style="display: none">
<td>Trace ID: 89339f4b-8736-4883-838d-9150fd7fd262</td>
</tr>
<tr style="display: none">
<td>HTTP Error Code: 400</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
有人可以帮助我吗?
答案 0 :(得分:0)
正如@JimGarrison所说,请仔细查看HTML中的错误信息,如下所示。
<tr> <td id="service_exception_message" >AADSTS90014: The request body must contain the following parameter: 'client_id'.</td> </tr> <tr style="display: none"> <td>Trace ID: 89339f4b-8736-4883-838d-9150fd7fd262</td> </tr> <tr style="display: none"> <td>HTTP Error Code: 400</td> </tr>
看起来好像下图。
这意味着您的请求正文中不包含所需的参数client_id
,这似乎错过了您网址中&
前面的client_id=1c1b7a0c-39ad-4ec8-a802-b31fff5af9a9
符号。
作为参考,请参阅文档Authorize access to web applications using OAuth 2.0 and Azure Active Directory
的{{3}}部分以了解更多详情。希望能帮助到你。如有任何疑虑,请随时告诉我。