Everything I have read looks to relate to AGOL apps and not a custom deployed 4.12 app.
I assume a request interceptor is needed to add it the imageryserver url. Where do I generate the token then?
Hi Jay, you might want to review our docs about working with the ArcGIS Platform, and about accessing secure resources:
Working with the ArcGIS Platform | ArcGIS API for JavaScript 4.12
Thanks Noah. I have been looking at those and, I'm sure I am overlooking something, everything I have read is describing the process to use it with a AGOL App. I need a custom app built in 4.12 to use subscriber content.
This workflow is specific to a custom JS API application. Requires making a registered app on AGO or via the Developer's site, and adding the relevant code to your app.
Working with the ArcGIS Platform | ArcGIS API for JavaScript 4.12
This sample uses a service proxy to access a premium service from AGO.
Directions widget | ArcGIS API for JavaScript 4.12
Sample using OAuth as recommended in the previous guide topics.
Access ArcGIS Online items using OAuthentication | ArcGIS API for JavaScript 4.12
You can also use a proxy to access secure services, from AGO and other Servers.
Noah
I got it working by using the URL from the subscriber content and adding a new item from web in my own AGO content. When I pasted the URL it prompted me for credentials and I chose to store them in the service. I then shared that new item in my AGO. Is this not a secure or recommended workflow?
Well, maybe it's fine. Is the new item in your AGO private or public? If it's public, I would be concerned that anyone could stumble across a link to that AGO item that consumes content that (presumably) requires credits.
Sure. I understand that. I'll keep an eye on it and see. I was more concerned with storing credentials in the service. Thanks for the quick replies!