<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error 403 when using a Client Credentials OAuth2 Token in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1249247#M4346</link>
    <description>&lt;P&gt;You're welcome!&amp;nbsp; There's an &lt;A href="https://community.esri.com/t5/arcgis-enterprise-ideas/implement-standard-client-credentials-oauth2/idi-p/1193409" target="_blank" rel="noopener"&gt;ArcGIS Enterprise Ideas suggestion to introduce standard client credentials/API key behavior&lt;/A&gt; to allow properly scoped service users that could use your support.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 21:02:51 GMT</pubDate>
    <dc:creator>BillMitchell</dc:creator>
    <dc:date>2023-01-18T21:02:51Z</dc:date>
    <item>
      <title>Error 403 when using a Client Credentials OAuth2 Token</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007481#M3638</link>
      <description>&lt;P&gt;I have a feature service on my organization's AGOL site which I want to have updated via an automated application.&amp;nbsp; The feature service is secured, and shared with my organization but not publicly.&lt;/P&gt;&lt;P&gt;I followed the &lt;A href="https://developers.arcgis.com/labs/rest/get-an-access-token/" target="_blank" rel="noopener"&gt;REST API instructions&lt;/A&gt; to create an application API key (generating the client_id and client_secret) and use those to get a token in Postman.&amp;nbsp; The request succeeds and I get a token back with an expiration of 7200 [seconds].&amp;nbsp; I use the tests feature of Postman to read the token into a variable, which I then use for the subsequent request.&lt;/P&gt;&lt;P&gt;Moving on to the &lt;A href="https://developers.arcgis.com/labs/rest/query-a-feature-layer/" target="_blank" rel="noopener"&gt;REST API Query a Feature Service instructions&lt;/A&gt;, I am able to put the search parameters in, I add the token as a parameter for the URL, but get an error (403) response:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "error": {
        "code": 403,
        "message": "You do not have permissions to access this resource or perform this operation.",
        "messageCode": "GWM_0003",
        "details": [
            "You do not have permissions to access this resource or perform this operation."
        ]
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The request (service id and token have been altered/redacted):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl --location --request POST 'https://services.arcgis.com/9XXXXXXXXXZ/ArcGIS/rest/services/testingMap/FeatureServer/0/query?token=wQXsOdT_BIGLONGSTRING0FA1PHANUM3RICS80GjRU3YBsFAc4yFrPvJI2KqvCcfP6XV-fzfN9EnbV4w-RNYc_4MwC-R3dAc7ed-9ut1IywjU7Cy_PZbo-9Tz6MIlQLpcTYyWwNg..' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'f=json' \
--data-urlencode 'outFields=*' \
--data-urlencode 'returnGeometry=True' \
--data-urlencode 'outSr=4326' \
--data-urlencode 'where=1=1'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can interact with the endpoint via a browser, and it works.&amp;nbsp; I can copy the token created in my browser into Postman and the request succeeds.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I authorize the app to access the feature service REST endpoint so that it can run in a fully automated way?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 18:32:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007481#M3638</guid>
      <dc:creator>BillMitchell</dc:creator>
      <dc:date>2020-12-07T18:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error 403 when using a Client Credentials OAuth2 Token</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007514#M3639</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can interact with the endpoint via a browser, and it works.&amp;nbsp; I can copy the token created in my browser into Postman and the request succeeds.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The way I read the above statement, you can use a user-token in the ArcGIS API for Python and it works, but an app-token isn't.&amp;nbsp; App tokens can only access AGOL services from the same owner that created and registered the app.&amp;nbsp; Is the app registered under the same owner of the data you are trying to access?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 20:04:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007514#M3639</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-12-07T20:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error 403 when using a Client Credentials OAuth2 Token</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007529#M3640</link>
      <description>&lt;P&gt;Changing the app ownership to my colleague (the feature service owner) has fixed the error.&lt;/P&gt;&lt;P&gt;It would be great if that caveat to client credentials, where the app owner and service owner &lt;EM&gt;must&lt;/EM&gt; be the same, was mentioned in the API Developer documentation linked above.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 20:35:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007529#M3640</guid>
      <dc:creator>BillMitchell</dc:creator>
      <dc:date>2020-12-07T20:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error 403 when using a Client Credentials OAuth2 Token</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007696#M3647</link>
      <description>&lt;P&gt;I feel your pain, I was in your exact same situation a while back, and it took me days and lots of searching to find someone on a different site with the answer.&amp;nbsp; I have yet to find actual Esri documentation that states it.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 14:26:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1007696#M3647</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-12-08T14:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error 403 when using a Client Credentials OAuth2 Token</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1249209#M4345</link>
      <description>&lt;P&gt;Thank you. I was stuck on this for hours.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 19:45:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1249209#M4345</guid>
      <dc:creator>DrewDowling</dc:creator>
      <dc:date>2023-01-18T19:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Error 403 when using a Client Credentials OAuth2 Token</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1249247#M4346</link>
      <description>&lt;P&gt;You're welcome!&amp;nbsp; There's an &lt;A href="https://community.esri.com/t5/arcgis-enterprise-ideas/implement-standard-client-credentials-oauth2/idi-p/1193409" target="_blank" rel="noopener"&gt;ArcGIS Enterprise Ideas suggestion to introduce standard client credentials/API key behavior&lt;/A&gt; to allow properly scoped service users that could use your support.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 21:02:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/error-403-when-using-a-client-credentials-oauth2/m-p/1249247#M4346</guid>
      <dc:creator>BillMitchell</dc:creator>
      <dc:date>2023-01-18T21:02:51Z</dc:date>
    </item>
  </channel>
</rss>

