我对azure身份验证有一个奇怪的问题.它适用于一种情况(使用adal登录角度应用程序)但不能在其他情况下登录(加载asp.net web api并通过swagger ui授权机制登录).我把它缩小到了一个帖子:
https://login.microsoftonline.com/te/{tenantid}/oauth2/authresp
Run Code Online (Sandbox Code Playgroud)
无效返回的端点:
302
<html>
<head>
<title>Object moved</title></head>
<body>
<h2>Object moved to <a href="http://localhost:49919/swagger/ui/oauth2redirect-html#error=server_error&error_description=AADB2C%3a+An+exception+has+occured.%0d%0aCorrelation+ID%3a+1816d2f8-aa74-4433-a7c0-d9c8fabebdb0%0d%0aTimestamp%3a+2017-10-27+13%3a46%3a08Z%0d%0a&state={ommitted}">here</a>.</h2>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
基本上告诉我发生了异常.
error_description = AADB2C发生了异常.
CorrelationID = 1816d2f8-aa74-4433-a7c0-d9c8fabebdb0
时间戳= 2017-10-27 13:46:08
角度应用程序,完全相同的帖子,但然而返回带有令牌ID的链接:
302
<html>
<head>
<title>Object moved</title>
</head>
<body>
<h2>Object moved to <a href="http://localhost:4200/#state={state -
ommitted}&id_token={id token - omitted}">here</a>.
</h2>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我看不出帖子有什么不同.这个不起作用(从web api项目的swagger ui发起)
POST https://login.microsoftonline.com/te/{tenant - omitted}/oauth2/authresp HTTP/1.1
Host: login.microsoftonline.com
Connection: keep-alive
Content-Length: 1595
Cache-Control: max-age=0
Origin: https://login.microsoftonline.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 …
Run Code Online (Sandbox Code Playgroud)