<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Liferay 7.4 DXP fixpack 23: GraphQL does not work with OAuth2 app</title>
  <link rel="self" href="https://liferay.dev/ja/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121421418" />
  <subtitle>Liferay 7.4 DXP fixpack 23: GraphQL does not work with OAuth2 app</subtitle>
  <id>https://liferay.dev/ja/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121421418</id>
  <updated>2026-04-25T13:35:48Z</updated>
  <dc:date>2026-04-25T13:35:48Z</dc:date>
  <entry>
    <title>Liferay 7.4 DXP fixpack 23: GraphQL does not work with OAuth2 app</title>
    <link rel="alternate" href="https://liferay.dev/ja/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121421417" />
    <author>
      <name>Alessandro Candini</name>
    </author>
    <id>https://liferay.dev/ja/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121421417</id>
    <updated>2022-05-19T08:17:09Z</updated>
    <published>2022-05-11T15:21:30Z</published>
    <summary type="html">&lt;p&gt;Hi everyone,&lt;/p&gt;
&lt;p&gt;we are trying to get GraphQL working with Liferay DXP 7.4 fixpack 23.&lt;/p&gt;
&lt;p&gt;On Graph&lt;u&gt;
    &lt;strong&gt;i&lt;/strong&gt;&lt;/u&gt;QL interface (/o/api), as logged user, we can
  perform queries like the following:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;query {
  contentElements(siteKey: &amp;quot;12345&amp;quot;) {
    items {
      id
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And we get the correct JSON as a response.&lt;/p&gt;
&lt;p&gt;But if we try to do that with curl, &lt;a
    href="https://learn.liferay.com/dxp/latest/en/headless-delivery/consuming-apis/consuming-graphql-apis.html#calling-a-service-using-oauth2"&gt;as
    described in the official documentation&lt;/a&gt;, it does not work: we
  get the error &amp;quot;401 Unauthorized&amp;quot;.&lt;/p&gt;
&lt;p&gt;Unlike &lt;a
    href="https://liferay.dev/ask/questions/development/re-graphql-requests-401-unauthorized-with-oauth2-bearer-token"&gt;in
    this forum thread&lt;/a&gt;, we did not get the correct response even
  enabling every scope presento for OAUTH2 applications.&lt;/p&gt;
&lt;p&gt;In addition, the same call made with the relative REST API with
  OAuth2 works like a charm (/o/headless-delivery/v1.0/sites/12345/content-elements).&lt;/p&gt;
&lt;p&gt;Have you got any idea on how to solve this?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;
&lt;p&gt;
  &lt;u&gt;
    &lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/u&gt;: we are trying to perform GraphQL calls
  also from Postman, but we get the same error. With OAuth2 does not
  work, with basic auth it works, but this is not duable in a third
  party SPA applicatio, as we would to.&lt;/p&gt;
&lt;p&gt;Any suggestions? What are we missing in order to make GraphQL on
  OAuth2 work?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Alessandro Candini</dc:creator>
    <dc:date>2022-05-11T15:21:30Z</dc:date>
  </entry>
</feed>
