Reputation: 4052
I'm trying to provide public access to the URL http://localhost:8080/api/jsonws/journalarticle/get-article-by-url-title/group-id/10182/url-title/events
When I try accessing this URL without being logged in to Liferay, I get the following error:
{"exception":"Authenticated access required"}
I've tried setting the following in portal-ext.properties:
json.service.public.methods=*
jsonws.web.service.public.methods=*
I've also tried setting the values to get*
with no luck. I need to access this API through an AngularJs application that is hosted on a different domain, so I also need to set up CORS access if possible.
Upvotes: 1
Views: 2817
Reputation: 174
This properties will disabled the authorization for the json web services.
#disable authentication in json web service
json.service.auth.token.enabled=false
Upvotes: 0
Reputation: 339
Even I have tried all the above non have worked, What you can do is in your custom portlet create your own API for JSON web services in that call the API
JournalArticleLocalServiceUtil.getArticleByUrlTitle(groupId, urlTitle);
In your *ServiceImp.java add the tag below, see the example
@AccessControlled(guestAccessEnabled=true)
Example:
@AccessControlled(guestAccessEnabled=true)
public JurnalArtical yourMethodName(){...}
Upvotes: 2
Reputation: 632
Try adding properties in portal-ext.properties
json.web.service.enabled=true
json.service.auth.token.enabled=false
auth.token.check.enabled=false
json.service.auth.token.hosts.allowed=
leave the fourth one empty.
This will disable the authentication needed for JSON call for Liferay.
Upvotes: 0