2017-10-27 7 views
6

私は紺色の認証に奇妙な問題があります。これは1つのシナリオ(adalを使用して角型アプリケーションでログイン)ではなく、他のプラットフォームでは動作しません(asp.net web apiをロードし、swagger ui authorizeメカニズム経由でログインします)。Azure AD B2C oauth/OpenIdConnectの問題

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&amp;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&amp;state={ommitted}">here</a>.</h2> 
</body> 
</html> 

基本的に例外が発生した私に言って:むしろunhelpfully返し

https://login.microsoftonline.com/te/{tenantid}/oauth2/authresp 

エンドポイント:私はへのポストにそれを絞られています。

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}&amp;id_token={id token - omitted}">here</a>. 
    </h2> 
    </body> 
</html> 

投稿には違いはありません。この1つは動作しません

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 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 
DNT: 1 
Referer: https://login.microsoftonline.com/{tenant - omitted}/oauth2/authorize?client_id={clientid - omitted}&redirect_uri=https:%2f%2flogin.microsoftonline.com%2fte%2f{tenant - omitted}%2foauth2%2fauthresp&response_type=id_token&response_mode=form_post&nonce={nonce}&state=StateProperties 
Accept-Encoding: gzip, deflate, br 
Accept-Language: en-GB,en;q=0.9,de-CH;q=0.8,de;q=0.7,fr-CH;q=0.6,fr;q=0.5,it-CH;q=0.4,it;q=0.3 
Cookie: {cookie - omitted}=; x-ms-gateway-slice=005; stsservicecookie=cpim_te 

id_token={omitted} 

(Web APIをプロジェクトに闊歩UIから開始された)しかし、この記事ではありません:ポストとして

POST https://login.microsoftonline.com/te/{tenant - omitted}/oauth2/authresp HTTP/1.1 
Host: login.microsoftonline.com 
Connection: keep-alive 
Content-Length: 1590 
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 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 
DNT: 1 
Referer: https://login.microsoftonline.com/{tenant - omitted}/oauth2/authorize?client_id={clientid - omitted}&redirect_uri=https:%2f%2flogin.microsoftonline.com%2fte%2f{tenant - omitted}%2foauth2%2fauthresp&response_type=id_token&response_mode=form_post&nonce={nonce}&state=StateProperties 
Accept-Encoding: gzip, deflate, br 
Accept-Language: en-GB,en;q=0.9,de-CH;q=0.8,de;q=0.7,fr-CH;q=0.6,fr;q=0.5,it-CH;q=0.4,it;q=0.3 
Cookie: {cookie - omitted}; x-ms-gateway-slice=003; stsservicecookie=cpim_te 

id_token={omitted} 

は問題がいずれかのクッキーのどこかに存在しなければならないほとんど同一であり、またはIDトークン(セキュリティ上の理由から私が提供することはできません)。両方の要求からのIDトークンをhttp://www.jwt.ioに貼り付けると、両方に存在する正しいクレームと同じ情報が私に与えられます。だから私はちょっと立ち往生していて、紺碧のチームの誰かが踏み込んで助けてくれることを願っていますか?あなたは/v2.0/ B2Cエンドポイントを呼び出していないよう

感謝

+0

どちらの場合でも共有できるページまたはリクエストURLがありますか?そうでない場合は、リクエストURLをフィドラーリクエストから取得し、localhostをターゲットにしていても両方の場合に対応できますか? –

+0

はい私はフィドラーからの完全なリクエストを提供できますが、機密情報が含まれているのでここに投稿することはできません – Magrangs

+0

@OmerIqbal私はLinkedInにあなたを追加しました。ありがとう – Magrangs

答えて

1

はあなたの要求のサンプル中のリファラに基づいて、それが見えます。たとえば、次の要求で、パスは/ {テナント} /のOAuth2/V2.0 /認可...

https://login.microsoftonline.com/{tenant}/oauth2/authorize?client_id={clientid}&redirect_uri=https:%2f%2flogin.microsoftonline.com%2fte%2f{tenant}%2foauth2%2fauthresp&response_type=id_token&response_mode=form_post&nonce={nonce}&state=StateProperties 

このためである必要があり、あなたのアプリの両方の間で予期しない動作を取得しています。これは、使用しているアプリケーションがB2Cポータルを使用して作成されていないことを意味します(オフラインチャットでも確認済み)。

現時点では、B2CのみがB2Cポータルを通じて作成されたアプリケーションをサポートしています。したがって、B2Cポータルからアプリケーションを作成してもう一度やり直すことができれば、この問題は解決されるはずです。

+0

これは私たちの問題を解決したようです。 – Magrangs

+0

アプリ登録を初めて作成したときに、それらはv1エンドポイントで作成されました。これに対するトリックは、Omerが説明したようにb2cポータルにアプリケーションを作成することでした。 「今すぐお試しください」ボタンを使って、呼び出すべきURLを確認することができます。 – Magrangs

+0

また、web api configがv2.0ポリシーエンドポイントを使用していることを確認してください。すなわちhttps://login.microsoftonline.com/{0}/v2.0/.well-known/openid-configuration?p={1}(0はあなたのテナント、1はあなたのポリシーです) – Magrangs

関連する問題