Azure AD の OpenID Connect に関する問題

Yes, we are using KeyCloak and use Azure AD for federation in behind it. It’s correctly bootstrapping the email, so it must do some kind of mapping just like the one you mention.

We have a fix. We were using the v1.0 version of the endpoint. When we switch to the v2.0, it works and we get the email just fine. Thanks for all your help @david, talking it through helps us triage the issue.

Glad to hear it!

Would you be able to describe how to tell whether you’re using v1 or v2 in the azure portal? Then we can add a note to the instructions above so it doesn’t catch anyone else!

Yep, adding /v2.0/ to the metadata document url.

https://login.microsoftonline.com/replace-with-tenant-id/v2.0/.well-known/openid-configuration

Perfect, thanks. I’ve added a note to the OP

こんにちは、OP と非常に似た問題が発生しています。NHS.net に対して認証を行っていますが、その背後には Active Directory があり、おそらく Azure によって提供されていると思われます。OIDC プラグインを使用しており、以下のエラーが発生しています:

(oidc) Authentication failure! invalid_credentials: OAuth2::Error,
(エラーはカンマで終わっており、OP のエラーとは異なり、それ以上のデータは表示されません)

認可スコープとトークンスコープの設定を openid email profile に変更してみましたが(これらは設定 URL のデータによると OIDC エンドポイントでサポートされています)、

それでも UI で同じエラーが表示されます:「申し訳ありませんが、アカウントの認可中にエラーが発生しました。もう一度お試しください。」

JWT からデータが返されていないようです。したがって、「メールフィールドが不足している」問題とは完全には一致しませんが、同じエラーで始まりました。Meta でこのエラーに関連しそうな他の場所としては、SSL Error during OAuth2 があります。これは SSL 問題に関連していることが判明しました(興味深いことに、NHS.net の証明書にもその問題があり、報告済みです)。SSL 対策を適用したところ、Faraday の SSL エラーは解消されましたが、OpenID Connect フローの一部がまだ破損しているように見えます。

この問題のデバッグに向けた次のステップについて、ご提案はありますか?