POST
|
Hi, I have developed an application that shows a WebMap from ArcGIS portal by using the ArcGIS JS API. I implemented authentication flow by using the IdentityManager. I'm able to get the token and register it and the secured resource then loads correctly. However, when I refresh the page in browser the registered token/credential is not available anymore. Is there a way to keep the sign in status as long as the token is valid? Or is it so that I need to store the access token (and possibly other needed details) my self in client side and then just validate the token before request to JS API and register it again? What is the recommended way to do this? Regards, Eemeli identityManager.checkSignInStatus( portalUrl + "/sharing" ).then( function ( credential ) {
// User is already authenticated.
identityManager.registerToken( {
token: credential.token,
server: portalUrl
} );
resolve( true );
} ).catch( function( error ) {
// User not authenticated, login the user.
identityManager.getCredential( portalUrl + "/sharing" ).then( function ( credential ) {
// Register the token after authentication.
// The token is valid 60 min by default.
identityManager.registerToken( {
token: credential.token,
server: portalUrl + "/sharing/rest",
expires: credential.expires,
ssl: credential.ssl,
userId: credential.userId
} );
resolve( true );
} );
} );
... View more
02-05-2020
10:49 PM
|
1
|
2
|
2554
|
POST
|
Another question: I just found out that in JS API documentation (Search | API Reference | ArcGIS API for JavaScript 3.30 ) It is said that "NOTE: When searching feature layers, the GlobalID field cannot be used to return results.". Why is that? Does it mean that is should not be used, because clearly it's possible to use it as search term.
... View more
12-05-2019
01:19 AM
|
0
|
1
|
510
|
POST
|
Hi, I have implemented a custom widget. Within that widget I use the Search widget ("esri/dijit/Search") in order to, well search stuff. I' using the widget approximately as below: // Using "esri/dijit/Search" in custom widget.
// Setting sources, every layer which is "Queryable" i.e. capabilities contains "Query".
// Search field is "GlobalID" and value is a GUID.
foreach( layer ) {
sources.push(
{
featureLayer: this.map._layers[ layer ],
enableLabel: false,
searchFields: [ "GlobalID" ],
displayField: "GlobalID",
exactMatch: false,
outFields: [ "*" ]
} );
}
search.set( "sources", sources );
search.startup();
search.search( <GUID> ); This works fine in my developer enviroment (local WebAppBuilder and ArcGIS Online with developer account). If I use the same widget in our on-premise portal the search does not work and it returns: {"error":{"code":500,"message":"Where clause is invalid.","details":[]}} I noticed that the query params in the search requests differs between Online and On-premise portal: Developer/Online: where=UPPER(GlobalID)%20LIKE%20%27%25722380BF-FF9B-442E-9D9E-5C7A2CAF9E91%25%27&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=0.01866138385297604&outFields=*&outSR=102100&resultRecordCount=6&quantizationParameters=%7B%22mode%22%3A%22edit%22%7D On-premise/portal where=GlobalID%20%3D%20%7BBE77065E-ABAC-4A75-B79D-40800B477105%7D&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=0.01866138385297604&outFields=*&outSR=102100&resultRecordCount=6 Probably there are a lot of differences between Online and portal but more important question is that why that On-premise/portal WHERE clause does not work? And why are those clauses different as both seems to use same JS API version (3.28)? Is it a bug in search Widget? Regards, Eemeli
... View more
12-04-2019
03:07 AM
|
0
|
2
|
623
|
POST
|
Hi, I'm wondering what are the options when authenticating a user when showing a secured WebMap using JS API? 1. Use OAuth flow. 2. Ask the credentials on client side and use Identitymanager.generateToken. What else? Can we just let the portal handle the authentication, i.e. when opening the map the portal would ask for credentials and user would have on-going session and API calls would just work? This way I can get the authen form visible but it ends up in " 'referer' must be specified. " error when pressong "Login". The background for this question is that I'm working on a software where OAuth flow is not very trivial to accomplish and on the other hand I would not like to create my own form that collects user credentials on client side. I'd prefer ArcGIS to show the login form and handle the authentication. Thanks!
... View more
10-11-2019
01:34 AM
|
0
|
1
|
549
|
POST
|
Well, this wasn't the fix after all. It just happened to work for a while after I changed that. However after some more investigation it seems that exception comes from the workers when creating a Map. For the first load of the map the workers in esriConfig are not available and when the JSAPI tries to read e.g. portalUrl from that undefined object it throws an error. Is there a way to set like "default" workers? I'm not familiar with the workers framework, I understand the point it being there but is it something that is related to a map and it's data or are the workers loaded from portal or always set from the code? The error may be related to the javascript engine I need to use, but can I somehow use some default workers so that would not get that 'undefined' exception? The way I load the map doesn't really differ from any Esri example, like this one: https://developers.arcgis.com/javascript/latest/sample-code/intro-mapview/index.html Edit: New API documentation (https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#workers) says: "Modify the configuration to specify locations of packages to be loaded with the workers framework or to define a feature detection." How can I determine the "locations"?
... View more
10-02-2019
12:08 AM
|
0
|
0
|
468
|
POST
|
I probably was able to make this work. I programmatically changed the esriConfig portalUrl to point our own portal. However it seems to be required to reset the portalUrl back to default in order to load a baseMap. At least it seems to work now when I reset the portalUrl before building the map from scratch. esriConfig.portalUrl = "https://www.arcgis.com";
... View more
10-01-2019
03:22 AM
|
0
|
1
|
468
|
POST
|
I use ArcGIS JSAPI directly from js.arcgis.com. I more or less randomly get following error when trying to load a map into a MapView from portal or when creating a map from scratch. Am I missing some configuration or something like that? Any ideas? Maybe some availability issue (for me it doesn't look like one) as it works often OK after I load the same map after the error. The JS code runs in IE, by the way. There is no other option as IE is in this case embedded into a native desktop application and changing it is not an option. However, it doesn't look like browser issue either... Should I after all use local copy of the API? If so are there any instructions how to do that? Thanks! Exception was thrown at line 461, column 236 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference Exception was thrown at line 188, column 29 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference Exception was thrown at line 188, column 120 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference Exception was thrown at line 188, column 29 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference Exception was thrown at line 188, column 120 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference Exception was thrown at line 188, column 29 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/ 0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference
... View more
09-26-2019
04:22 AM
|
0
|
3
|
656
|
POST
|
Hi, I think I was able to resolve this. It was about timing as there was on-going "pan" and therefore the original point was "moving on the screen" and the resulted screenpoint was more or less random. I fixed this by waiting that the view animation is done: _view.watch( "animation",function( response ) {
if( response && response.state !== "running" ) {
var screenPt = _view.toScreen( point );
}
}
... View more
09-11-2019
10:01 PM
|
0
|
0
|
654
|
POST
|
Hi Robert, Actually using "basemapView.view" was just the last experiment I had and accidentally left it there as an example. I have the same result when using "_view": the generated screen point is out of screen. var screenPt = _view.toScreen( point );
... View more
09-11-2019
09:35 PM
|
0
|
0
|
654
|
POST
|
Hi, I have an application that loads a Webmap from portal using ArcGIS JS version 4.12. Then I navigate to certain point with MapView goTo function. That works fine. Then I need to convert the Point into ScreenPoint in order to do a hittest. When I do the "toScreen" conversion it returns a point on screen that is not on the right place. Am I missing something here, or should somehow take the spatial reference of the map into account. The Point I create from x and y coordinates points into the right place. Why does the "toScreen" point into a wrong place even though the goto leads into right place? I have tried to change or set different spatial references for the point before "toScreen" but it does not seem to help. Example: var point = new Point();
point.longitude = "-2.12953405978807";
point.latitude = "50.6877745154717";
// screenPt is x: 1210, y: 416 although it should be something like x: 959 & y: 528.
var screenPt = _view.basemapView.view.toScreen( point );
... View more
09-11-2019
03:17 AM
|
0
|
3
|
798
|
Title | Kudos | Posted |
---|---|---|
1 | 02-05-2020 10:49 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|