Change in identity manager between 2.5 and 2.6

2499
45
Jump to solution
01-31-2012 07:22 AM
JeffPace
MVP Alum
My identity manager works at 2.5.  I don't have any custom code in it at the moment, it just hits the first secure service and prompts for login (AWESOME THANK YOU)

when I change my application to 2.6, firebug throws and error saying

tokenserviceurl not defined

and hangs login.

What changed?
0 Kudos
45 Replies
JeffPace
MVP Alum
registerServers takes an array of ServerInfo objects so you'd just need to create a ServerInfo object for each server and add it to the array you provide to registerServers. See the IdentityManagerBase help topic for details:

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/identitymanagerbase.ht...


Hmmm, i dont know if that is going to work for us.

We use the recommended config of placing all our servers behind a Web App Firewall/reverse proxy.  But we use 1 proxy, and have many servers.

so

www.mymanatee.org/arcgis/rest/services/utilities/ goes to server 1
but
www.mymanatee.org/arcgis/rest/services/sheriff/ goes to server 2

using the registerServers class, they would both have the same serverInfo.server, but with different token services.

How would the application know which token server to use for which service ?
0 Kudos
derekswingley1
Frequent Contributor
Let's try this:

var serverInfo = new esri.ServerInfo();
serverInfo.server = 'https://www.mymanatee.org';
serverInfo.tokenServiceUrl = 'https://www.mymanatee.org/arcgis/tokens/generateToken';          
esri.id.registerServers([serverInfo]);


Can you let us know if that works?
0 Kudos
JeffPace
MVP Alum
Let's try this:

var serverInfo = new esri.ServerInfo(); serverInfo.server = 'https://www.mymanatee.org'; serverInfo.tokenServiceUrl = 'https://www.mymanatee.org/arcgis/tokens/generateToken';           esri.id.registerServers([serverInfo]);


Can you let us know if that works?


esri.ServerInfo is not a constructor
[Break On This Error] var serverInfo = new esri.ServerInfo();
0 Kudos
derekswingley1
Frequent Contributor
esri.ServerInfo is not a constructor
[Break On This Error] var serverInfo = new esri.ServerInfo();


Where are you running that code? It should be inside a function called by dojo.ready.
0 Kudos
JeffPace
MVP Alum
Where are you running that code? It should be inside a function called by dojo.ready.


well, not in dojo.ready , but you were correct.  I had it in the wrong spot (my dojo-fu was weak)

This has fixed me, thank you.
0 Kudos
derekswingley1
Frequent Contributor
Nice! Glad we finally got that sorted.
0 Kudos
JeffPace
MVP Alum
Nice! Glad we finally got that sorted.


unfortunately no, i was hitting a cached copy at 2.5.  Still cant seem to get this to work, still getting an undefined tokenservice url

My guess is I am not putting that code in the right place, just need to keep trying.
0 Kudos
derekswingley1
Frequent Contributor
Try inserting the code posted previously inside a function that runs after the page loads but before you create your map services that require tokens.
0 Kudos
JeffPace
MVP Alum
well rats.  I totally forgot about this issue, deployed today updating to 2.7 and broke my site.  Switching the api back to 2.5 fixes everything, so it is definately the above issue.

I just can't figure out where to set the serverinfo.  If i set it too early (when loading layers) i get a esri.id not defined or serverInfo is not a constructor.
If i set it too late, i get tokenservice not defined.

And I can't seem to find the sweet spot.
0 Kudos
derekswingley1
Frequent Contributor
Are you running the code posted previously at the top of your function that dojo.ready calls?
0 Kudos