I need to load a secured layer using an Esri token. In 3.X I did this:
const url = `${serviceUrl}?token=${esriToken}&f=json`
var featureLayer = new FeatureLayer({
url: url
});It worked great and would load the secure feature service.
I do the exact same thing in 4.X, and I get the pop-up asking me to sign in. I double-checked the URL, and it provides the JSON, so that's not the issue.
What gives? I already signed in using OAuth2. That's how I got the token. I don't want to have to sign in again. Please help. Thanks!