<?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>API security differences</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=110254054" />
  <subtitle>API security differences</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=110254054</id>
  <updated>2026-04-05T11:11:30Z</updated>
  <dc:date>2026-04-05T11:11:30Z</dc:date>
  <entry>
    <title>RE: API security differences</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110343048" />
    <author>
      <name>Pete Helgren</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110343048</id>
    <updated>2018-06-26T14:47:31Z</updated>
    <published>2018-06-26T14:47:31Z</published>
    <summary type="html">&lt;p&gt;Thanks.  That makes sense.  I haven't tested the idea yet because I
  ended up changing portal-ext.properties by
  adding json.service.auth.token.enabled=false  There might be other
  side effects with that so I'll have to do some additional testing.  As
  a follow up, and perhaps a bit OT, I have been looking for some
  examples and additional information on support for JSONP.  I did read
  that you can pass a callback parameter but I saw no example of the
  correct syntax.  I'll do some debugging but is there a
  &amp;quot;quick&amp;quot; answer here? (LR 7 GA5 CE)   I plan to try adding
  ?callBack='myCallBack' but I have no idea if that would work (yet).&lt;/p&gt;</summary>
    <dc:creator>Pete Helgren</dc:creator>
    <dc:date>2018-06-26T14:47:31Z</dc:date>
  </entry>
  <entry>
    <title>RE: API security differences</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110315611" />
    <author>
      <name>Minhchau Dang</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110315611</id>
    <updated>2018-06-21T23:05:47Z</updated>
    <published>2018-06-21T23:05:47Z</published>
    <summary type="html">&lt;blockquote&gt;
  &lt;div class="quote-title"&gt;Pete Helgren:&lt;/div&gt;
  &lt;div class="quote"&gt;
    &lt;div class="quote-content"&gt;
      &lt;p&gt;So, why the difference?  Postman doesn't authenticate and
        works.  The URL doesn't....&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;The authentication token check specifically only triggers when you're
  signed in (&lt;a
  href="https://github.com/liferay/liferay-portal/blob/7.0.6-ga7/portal-impl/src/com/liferay/portal/struts/JSONAction.java#L152-L160"&gt;reference&lt;/a&gt;),
  so it'll be skipped when you're not authenticated. In other words, the
  authentication token check will never run with Postman, and it's
  likely to always run in your browser unless you clear your cookies
  right before you paste the URL into your address bar.&lt;/p&gt;</summary>
    <dc:creator>Minhchau Dang</dc:creator>
    <dc:date>2018-06-21T23:05:47Z</dc:date>
  </entry>
  <entry>
    <title>API security differences</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110254053" />
    <author>
      <name>Pete Helgren</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110254053</id>
    <updated>2018-06-21T21:17:35Z</updated>
    <published>2018-06-21T21:17:35Z</published>
    <summary type="html">&lt;p&gt;I have a service builder api that I have exposed and is accessible
  using the api/jsonws panel in Liferay.  Works fine.   I can also
  invoke the API using Postman using a POST request with a URL of &lt;a
  href="http://localhost:8080/api/jsonws/invoke"&gt;http://localhost:8080/api/jsonws/invoke&lt;/a&gt; and
  a body (raw) of:&lt;br /&gt;
  &lt;br /&gt; {&lt;br /&gt;   
   &amp;quot;/media.mymediamethod/get-media-list&amp;quot;:{&lt;br /&gt;   
   &amp;quot;emailAddr&amp;quot;:&amp;quot;me@something.com&amp;quot;&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;
  &lt;br /&gt; This too, works like a charm.  But, if I use the URL like so:&lt;br /&gt;
  &lt;br /&gt; http://localhost:8080/api/jsonws/media.mymediamethod/get-media-list/email-addr/me%40something.com&lt;br /&gt;
  &lt;br /&gt; I get: &lt;/p&gt;
&lt;p&gt;Forbidden&lt;br /&gt; You do not have permission to access the requested resource. &lt;/p&gt;
&lt;p&gt;
  &lt;br /&gt; Now I understand that adding the p_auth parameter might help
  but what is throwing me is that I am running Postman without ANY
  authorizations at all.  Nothing in the header, no extra p_auth
  params.  Nothing.  And yet Postman will invoke with no authorization
  and a URL will not.  I even added
  the @AccessControlled(guestAccessEnabled=true)annotation to the method
  signature (didn't help).  I added the api to the &amp;quot;System
  Default&amp;quot; service access policy(didn't help) .  And yet the URL
  invocation doesn't work and Postman does.&lt;br /&gt;
  &lt;br /&gt; I am trying to enable an ajax invocation of the API (jQuery)
  from a remote server.  Again, Postman invokes with no issue, the
  URL...nothing but forbidden. So, why the difference?  Postman doesn't
  authenticate and works.  The URL doesn't....&lt;/p&gt;</summary>
    <dc:creator>Pete Helgren</dc:creator>
    <dc:date>2018-06-21T21:17:35Z</dc:date>
  </entry>
</feed>
