Select to view content in your preferred language

getting a Credential object using IdentityManager and ServerInfo

2281
11
08-14-2012 03:32 PM
DirkVandervoort
Frequent Contributor
The code below fails with the error message. How do I get the credential based on my token service URL?: TIA

faultCode:null faultString:'Error #2032: Stream Error. URL:https://gis.blahblahblah.com/arcgis/tokens?tokens' faultDetail:'null'


     var serverInfo:ServerInfo = new ServerInfo();
     serverInfo.tokenServiceURL="https://gis.blahblahblah.com/arcgis/tokens?tokens";
     IdentityManager.instance.generateCredential(serverInfo, myStupidUserName, myStupidPassword, new AsyncResponder(credentialResponse, credentialFault));
Tags (2)
0 Kudos
11 Replies
DasaPaddock
Esri Regular Contributor
Try setting the tokenServiceURL to the same as what you see on your server at /arcgis/rest/info

e.g.

http://sampleserver6.arcgisonline.com/arcgis/rest/info
0 Kudos
DirkVandervoort
Frequent Contributor
Try setting the tokenServiceURL to the same as what you see on your server at /arcgis/rest/info


That does not work.

It returns the mx.RPC.Fault message of:

faultCode:null faultString:'Error #2032: Stream Error. URL: https://gis.blahblahblah.com/ArcGIS/tokens' faultDetail:'null'


I'm on AGS 10.03 if that's any help.
0 Kudos
DasaPaddock
Esri Regular Contributor
Can you use HttpFox to see what the requests and responses are?
0 Kudos
DirkVandervoort
Frequent Contributor
Can you use HttpFox to see what the requests and responses are?


It's an AIR application, but I ran Fiddler (should have thought of that in the first place!). The returned message in plain text is:


{"error":{"code":499,"message":"Unauthorized access","details":[]}}


This is weird, because those are the same credentials I use getting the token using an HTTPService (mx.rpc.http.HTTPService.HTTPService).

Could it be my firewall? I will test again from outside the firewall later...
0 Kudos
DasaPaddock
Esri Regular Contributor
What was the request for this response? If the response code is 200, then this response should not be generating a "Error #2032: Stream Error".
0 Kudos
DirkVandervoort
Frequent Contributor
What was the request for this response? If the response code is 200, then this response should not be generating a "Error #2032: Stream Error".


Oops, my mistake. The Unauthorized access error was from trying to load the map.

The POST result trying to get the Credential is: 405 (Method Not Allowed)
0 Kudos
DasaPaddock
Esri Regular Contributor
0 Kudos
DirkVandervoort
Frequent Contributor
Try setting the tokenServiceURL to:
https://gis.blahblahblah.com/ArcGIS/tokens/generateToken


No, sorry.

The returned content:

405 - HTTP verb used to access this page is not allowed.
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
0 Kudos
DasaPaddock
Esri Regular Contributor
Are you able to generate a token from the HTML form at:
https://gis.blahblahblah.com/ArcGIS/tokens/
0 Kudos