Legacy Knowledge Base
公開されました Jun. 30, 2025

OAuth 経由で Liferay API にリクエストを行う Client Extension を使用しているとき、Web Server がベーシック認証を要求し続ける

Written By

Ricardo Couso

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

問題

  • Liferay 環境の前の Web サーバーは Basic Auth で設定されています。
  • Liferay は OAuth を使用して Liferay API にリクエストを行う Client Extension (CX) を使用します。
  • CXを使用するページがロードされると、ウェブサーバーは基本的な認証情報を一度提供した後でも要求し続ける。

環境

  • 四半期リリース 2024.Q1

解像度

  • ウェブサーバーがBasic Authで設定されている場合、最初のリクエストは認証情報の入力を求める。 それ以降のものは、再尋問を避けるために、トークン付きのBasicタイプのヘッダーAuthorizationを含む。
  • OAuth を使用した Liferay API へのリクエストは、Bearer タイプの Authorization で行われます。
  • ヘッダーAuthorizationで使用できるトークンは1つだけであり、Bearerが使用されるので、Webサーバーは認証情報を要求する。
  • この問題を避けるために、CXからのリクエストはLiferay APIへのものなので、OAuthを使う必要がないことに注意してください(認証サーバーとリソースサーバーは同じです)。 代わりに、この例のようにapiメソッドを使うこともできる:
    api('o/headless-admin-user/v1.0/my-user-account')
        .then((response) = response.json())
            .then((response) = {

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base