I have used the example in the attachments sample to 'manually' construct a url for an attachment
For unsecured services\attachments, I can set an Image source to this url successfully.
E.g.
const attachmentUrl = featureLayerUrl + "/" + oid + "/attachments/" + attachment.attachmentId
However, for secured services, constructing the url in this way and then appending the Credential token does not work.
E.g.
const attachmentUrl = featureLayerUrl + "/" + oid + "/attachments/" + attachment.attachmentId + "?token=" + app.portal.credential.token
The image status reports an Image.Error
onStatusChanged: if (thumbnail.status === Image.Error) workRecordThumbnail.source = "../assets/image-error.png"
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.
I am creating the Credential like this:
Credential {
id: portalCredential
oAuthClientInfo: OAuthClientInfo {
oAuthMode: Enums.OAuthModeUser
clientId: app.clientId
}
}
Any help?