Connecting Enterprise Portal webmap with JS Api 4x

507
1
12-23-2019 02:58 AM
VeliAlkan
New Contributor

Hello,

When i try to load a webamp from Enterprise Portal with JS Api 4x, I get a error which says "Invalid clien_id". I defined in my code to the portal url, but the Api tries to connect to ArcGIS Online. The application is not in AGOL, so that makes sense for the error message. What I don't understand is why does it try to connect with ArcGIS Online while I defined the portal url in code which refers to enterprise portal?

The url for the Enterprise Poral is for example: https://example.example.com/portal

Here is a snipper of the code:

var portal = new Portal({
url:"https://example.example.com/portal"
});
var info = new OAuthInfo({
appId: "",
popup: false
});
esriId.registerOAuthInfos([info]);
var webmap = new WebMap({
portalItem: {
id: ""
}
});

Could someone explain what I am doing wrong?

0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

I think what you are looking for is the esriConfig.portalUrl property:

config | ArcGIS API for JavaScript 4.14