Liferay 7.4 DXP fixpack 23: GraphQL does not work with OAuth2 app

thumbnail
Alessandro Candini, modified 3 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts

Hi everyone,

we are trying to get GraphQL working with Liferay DXP 7.4 fixpack 23.

On Graph iQL interface (/o/api), as logged user, we can perform queries like the following:

query {
  contentElements(siteKey: "12345") {
    items {
      id
    }
  }
}

And we get the correct JSON as a response.

But if we try to do that with curl, as described in the official documentation, it does not work: we get the error "401 Unauthorized".

Unlike in this forum thread, we did not get the correct response even enabling every scope presento for OAUTH2 applications.

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).

Have you got any idea on how to solve this?

Thanks in advance.

UPDATE: 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.

Any suggestions? What are we missing in order to make GraphQL on OAuth2 work?