How to allow unauthenticated (Guest user) requests for GraphQL
knowledge-article-header-disclaimer-how-to
knowledge-article-header-disclaimer
legacy-article
learn-legacy-article-disclaimer-text
Issue
- I implemented ReactJS Widget that relies to GraphQL requests to Custom Object values. Widget exposes object entries to the public. Problem is that unauthenticated GrapQL requests are disabled by default. Now Guest users cannot see the widget content.
- Is there way to disable GraphQL Guest User restriction?
Environment
- Liferay Quarterly Release 2024.q3.6
Resolution
- To allow Guest user view to Object entries, you will need to enable the Guest View permission to the entries. If the Object has ObjectRelationship, you will need to enable the view to them by adding the following configuration to the Service Access Policy → OBJECT_DEFAULT from "Control Panel --> Security --> Service Access Policy":
Service Class: com.liferay.object.rest.internal.resource.v1_0.ObjectEntryRelatedObjectsResourceImpl
Method Name: getCurrentObjectEntriesObjectRelationshipNamePage
This method retrieves the related object entries based on the ObjectRelationship. Therefore, if you have relationships, this method must be enabled as well.
did-this-article-resolve-your-issue