How do I get my REST query to return privately owned (by me) items that are hosted on my organization's ArcGIS Online Portal? My code uses ArcGIS REST JS to create a REST search query. The query successfully returns any items of mine that I have publicly shared, but not the items that are private. I authenticate my credentials in the script using the Identity Manager from the ArcGIS API for JavaScript, and I have no problems accessing my private layers in other ways through the script.
Here's the relevant snippet:
<SPAN class="comment token">// Authentication</SPAN>
<SPAN class="keyword token">var</SPAN> authInfo <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">OAuthInfo</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
appId<SPAN class="punctuation token">:</SPAN> myAppID<SPAN class="punctuation token">,</SPAN>
popup<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">false</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
esriId<SPAN class="punctuation token">.</SPAN><SPAN class="token function">registerOAuthInfos</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>authInfo<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
<SPAN class="comment token">// REST JS Query</SPAN>
<SPAN class="keyword token">const</SPAN> query <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">arcgisRest<SPAN class="punctuation token">.</SPAN>SearchQueryBuilder</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="token function">match</SPAN><SPAN class="punctuation token">(</SPAN>myUserName<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="keyword token">in</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"owner"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="token function">and</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="token function">match</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="keyword token">in</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"title"</SPAN><SPAN class="punctuation token">)</SPAN>
arcgisRest<SPAN class="punctuation token">.</SPAN><SPAN class="token function">searchItems</SPAN><SPAN class="punctuation token">(</SPAN>query<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Again, this query successfully returns my public but not my private items. Is there a way to pass my authentication along with the query? Any help would be appreciated.