<?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: Attachment URL with Token in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265419#M4876</link>
    <description>&lt;P&gt;I ran the following through Postman and got the image back.&amp;nbsp; Where 209 is the Feature ObjectId and 144 is the attachment objectid from the attachments info endpoint, attachments.&amp;nbsp; I had content type set to application/json&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stingray.svec.coop/server/rest/services/SVEC/Workorker_GPS/FeatureServer/0/209/attachments/144?f=json&amp;amp;token=MyToken&amp;amp;w=100" target="_blank"&gt;https://stingray.svec.coop/server/rest/services/SVEC/Workorker_GPS/FeatureServer/0/209/attachments/144?f=json&amp;amp;token=MyToken&amp;amp;w=100&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2023 13:23:05 GMT</pubDate>
    <dc:creator>ZachBray</dc:creator>
    <dc:date>2023-03-08T13:23:05Z</dc:date>
    <item>
      <title>Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264220#M4865</link>
      <description>&lt;P&gt;&lt;BR /&gt;I have used the example in the attachments sample to 'manually' construct a url for an attachment&lt;/P&gt;&lt;P&gt;For unsecured services\attachments, I can set an Image source to this url successfully.&lt;BR /&gt;E.g.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const attachmentUrl = featureLayerUrl + "/" + oid + "/attachments/" + attachment.attachmentId&lt;/LI-CODE&gt;&lt;P&gt;However, for secured services, constructing the url in this way and then appending the Credential token does not work.&lt;BR /&gt;E.g.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const attachmentUrl = featureLayerUrl + "/" + oid + "/attachments/" + attachment.attachmentId + "?token=" + app.portal.credential.token&lt;/LI-CODE&gt;&lt;P&gt;The image status reports an Image.Error&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;onStatusChanged: if (thumbnail.status === Image.Error) workRecordThumbnail.source = "../assets/image-error.png"&lt;/LI-CODE&gt;&lt;P&gt;The portal credential works to access the services (feature layers) but it seems I cannot simply append the credential token to the attachment url to view the attachment.&lt;/P&gt;&lt;P&gt;I am creating the Credential like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Credential {
  id: portalCredential
  oAuthClientInfo: OAuthClientInfo {
    oAuthMode: Enums.OAuthModeUser
    clientId: app.clientId
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Any help?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Mar 2023 00:18:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264220#M4865</guid>
      <dc:creator>DavidPuckett</dc:creator>
      <dc:date>2023-03-04T00:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264434#M4866</link>
      <description>&lt;P&gt;Have you tried including the f query parameter to your attachmentURL?&lt;/P&gt;&lt;P&gt;const attachmentUrl = featureLayerUrl + "/" + oid + "/attachments/" + attachment.attachmentId + "?f=json&amp;amp;token=" + app.portal.credential.token&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 12:13:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264434#M4866</guid>
      <dc:creator>ZachBray</dc:creator>
      <dc:date>2023-03-06T12:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264701#M4868</link>
      <description>&lt;P&gt;Thanks for the idea but it didn't resolve the issue. Still can't get to the attachment.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 20:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264701#M4868</guid>
      <dc:creator>DavidPuckett</dc:creator>
      <dc:date>2023-03-06T20:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264750#M4871</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7317"&gt;@DavidPuckett&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Using the online map viewer and checking the network traffic, it looks like your url format is correct.&lt;/P&gt;&lt;P&gt;This is for OID=1, which only has one attachment (text file seen below).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-03-06 at 3.28.56 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/64472i5EB8919FF985D7C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2023-03-06 at 3.28.56 PM.png" alt="Screen Shot 2023-03-06 at 3.28.56 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Once you're logged in and have the token, if it's not working in the app I'd copy/paste that into the browser and see if that works.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 23:40:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1264750#M4871</guid>
      <dc:creator>JamesBallard1</dc:creator>
      <dc:date>2023-03-06T23:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265099#M4875</link>
      <description>&lt;P&gt;Pasting the url with the token from my app doesn't work either. I get an error from Web Adaptor saying 'Could not access any server machines. Please contact you system administrator'. So I guess the question is, why doesn't the token generated from the credential when a named user signs in work to get access to the attachments?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 18:32:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265099#M4875</guid>
      <dc:creator>DavidPuckett</dc:creator>
      <dc:date>2023-03-07T18:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265419#M4876</link>
      <description>&lt;P&gt;I ran the following through Postman and got the image back.&amp;nbsp; Where 209 is the Feature ObjectId and 144 is the attachment objectid from the attachments info endpoint, attachments.&amp;nbsp; I had content type set to application/json&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stingray.svec.coop/server/rest/services/SVEC/Workorker_GPS/FeatureServer/0/209/attachments/144?f=json&amp;amp;token=MyToken&amp;amp;w=100" target="_blank"&gt;https://stingray.svec.coop/server/rest/services/SVEC/Workorker_GPS/FeatureServer/0/209/attachments/144?f=json&amp;amp;token=MyToken&amp;amp;w=100&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 13:23:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265419#M4876</guid>
      <dc:creator>ZachBray</dc:creator>
      <dc:date>2023-03-08T13:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265420#M4877</link>
      <description>&lt;P&gt;Forgot to mention, I added the w query parameter as referenced in the REST API docs.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/services-reference/enterprise/attachment-feature-service-.htm" target="_blank"&gt;https://developers.arcgis.com/rest/services-reference/enterprise/attachment-feature-service-.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 13:26:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265420#M4877</guid>
      <dc:creator>ZachBray</dc:creator>
      <dc:date>2023-03-08T13:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265567#M4878</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7317"&gt;@DavidPuckett&lt;/a&gt;&amp;nbsp;I am not sure, unfortunately. There may be some additional level of complexity in your situation compared to what I've tested. If&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/482900"&gt;@ZachBray&lt;/a&gt;&amp;nbsp;'s suggestions don't help, I recommend reaching out to support so we can further help you.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 17:12:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265567#M4878</guid>
      <dc:creator>JamesBallard1</dc:creator>
      <dc:date>2023-03-08T17:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265685#M4879</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/482900"&gt;@ZachBray&lt;/a&gt;thank you for this. So did you have an issue with using the url with a token as the source for an image? But using a Post worked for you? If so, I would be curious how you set the image source to the response from the Post request.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 19:33:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265685#M4879</guid>
      <dc:creator>DavidPuckett</dc:creator>
      <dc:date>2023-03-08T19:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265688#M4880</link>
      <description>&lt;P&gt;I suspect you are right &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/405084"&gt;@JamesBallard1&lt;/a&gt; We have a complex federated enterprise portal in place... thank you for the input.&lt;/P&gt;&lt;P&gt;I am curious if others have successfully used the attachment url with a token to display image attachments that are in secure portal environments however. Like, is this *supposed* to work ?! :collision:&lt;/img&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 19:36:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265688#M4880</guid>
      <dc:creator>DavidPuckett</dc:creator>
      <dc:date>2023-03-08T19:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265779#M4881</link>
      <description>&lt;P data-unlink="true"&gt;I was able to copy and paste the url string from Postman with a recent token value into a Chrome browser window and get the attachment.&amp;nbsp; We have a federated Portal, Server setup as well.&amp;nbsp; I got my token through&amp;nbsp;https://my_webadapter_server/portal/sharing/rest/generateToken.&amp;nbsp; I supplied a username, password, client = referer, f=json, referer=https://my_webadapter_server/server as the form body.&lt;/P&gt;&lt;P data-unlink="true"&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 22:00:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1265779#M4881</guid>
      <dc:creator>ZachBray</dc:creator>
      <dc:date>2023-03-08T22:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1266145#M4882</link>
      <description>&lt;P&gt;So I created a QML NetworkRequest that I used to POST a request using the url to the attachment image and passing the token, f:json and referer into the request. I got back the same web adaptor error, as html &lt;span class="lia-unicode-emoji" title=":pensive_face:"&gt;😔&lt;/span&gt; Thanks for the suggestions again &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/482900"&gt;@ZachBray&lt;/a&gt; but I'm afraid there is something happening with the token that is being generated. I remain open to ideas however...&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 19:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1266145#M4882</guid>
      <dc:creator>DavidPuckett</dc:creator>
      <dc:date>2023-03-09T19:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment URL with Token</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1266233#M4884</link>
      <description>&lt;P&gt;I was using the generateToken endpoint and it looks like you are using the oauth2 endpoint.&amp;nbsp; I was able to get an access_token using .../rest/oauth2/authorize?client_id=????&amp;amp;response_type=token&amp;amp;redirect_uri=????.&amp;nbsp; I could then copy paste the access_token into my same attachments request in a Chrome browser Window and get the image back.&amp;nbsp; So I would think that this should work.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your error message indicated that it could not find any server machines.&amp;nbsp; Is there any potential networking issues, your machine not able to get to the server?&amp;nbsp; Was the Feature Service you are working with published with attachments enabled?&amp;nbsp; Are you able to access the attachment through another method, I confirmed mine through ArcGIS Pro and by making an attachments info call which is just .../FeatureServer/layer_id/objectId/attachments.&amp;nbsp; The attachments info call is where I got the attachment object id I need to get the actual image back.&amp;nbsp; Can you return just your expected access_token so that you could copy it into a browser window to confirm it is valid?&lt;/P&gt;&lt;P&gt;Just throwing out somethings that might jog your memory.&amp;nbsp; I was able to make this work in my environment, so you should be able to as well.&lt;/P&gt;&lt;P&gt;Good luck.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 22:02:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/attachment-url-with-token/m-p/1266233#M4884</guid>
      <dc:creator>ZachBray</dc:creator>
      <dc:date>2023-03-09T22:02:33Z</dc:date>
    </item>
  </channel>
</rss>

