ArcGIS Server tokens not working

8932
9
12-12-2014 02:26 PM
DonaldBrown
Occasional Contributor

I'm using ArcGIS Server 10.2.2 on Linux.

When I manually request a token from:

https://local_machine_name:6080/arcgis/tokens/

It works fine. When I manually request a token from (through web server):

https://webserver_domain/arcgis/tokens/

It doesn't work. I get:

Invalid request

Usage: https://webserver_domain/arcgis/tokens?request=gettoken&username=username&password=password&

Usage: https://webserver_domain/arcgis/tokens/generateToken?username=username&password=password&

Usage: https://webserver_domain/arcgis/tokens/gettoken.html

When I request manually with this URL (note the 'admin'), it works fine (this is through the web server):

https://webserver_domain/arcgis/admin/generatetoken/

So, it seems like through the REST endpoint, the 'post' is getting mangled between the web server and the GIS server?

Then, through the 'admin' endpoint, the 'post' works fine.

Any ideas?

One more question.... Why are there two ways to get a token? Is one method preferable?

9 Replies
VinceAngelo
Esri Esteemed Contributor

Quoting the JavaScript API documentation:

The request to the token service must be made over HTTPS and all subsequent requests that use the token also need to be made over HTTPS if required by the resource.

The ArcGIS Server documentation also explains how to disable the insecure configuration that permits HTTP requests in:

Securing your ArcGIS Server site » Configuring ArcGIS Server to be secure » Disabling token acquisit...

- V

0 Kudos
DonaldBrown
Occasional Contributor

Thanks for the information. I think it's a good ideas to disable the 'get' token requests. I will probably implement that.

However, that doesn't solve my problem of getting the 'post' to work through the REST endpoint. I edited my original post to be more clear. I am using https for all requests.

0 Kudos
DrewDowling
Occasional Contributor III

Donal

Did you ever get a solution to this. I've started having the same problem on a new environment I am building. token requests fail using a web adapter but work fine connecting to directly to the web server. I have set up everything to use https. and I'm not getting any errors with logging in and displaying map services, only with token generation.

0 Kudos
DonaldBrown
Occasional Contributor

Nope, I haven't been able to get this to work. So, the questions remain:

1) Why are there two places to get a token?:

https://MyDomain/arcgis/tokens/ https://webserver_domain/arcgis/tokens/

and

https://MyDomain/arcgis/admin/generatetoken

2) Why does the first one NOT work (with the above error messages), while the second URL works fine?

DrewDowling
Occasional Contributor III

Donal

I just cam across this thread. I haven't tested it yet but my web adapters all use a name other than "arcgis" so I'm thinking it's my problem. I'm about to test. I'll let you know the results.

Also the second url you show, /admin/generatetoken/, is to the admin console as opposed to the regular arcgis server front end. I don't think this console is accessible from outside of the server that hosts it, not sure about this though.

0 Kudos
DonaldBrown
Occasional Contributor

We don't use the Web Adapter, so I have a different problem.

And yes, /admin/generatetoken/ is available outside the Server network if you want it to be.

0 Kudos
ElizabethNolan
New Contributor III

Hi,

Did you ever get this to work? We are having the exact same issue. We are using an F5, no web adapter, and 3 clustered arcgis servers running 10.4. Generate token works on the local host. We just upgraded to 10.4.1 (have not been able to test if this made any difference not that we upgrade thinking it would we were having a different issue and needed to upgrade to fix it).

0 Kudos
DianeHarshbarger
New Contributor II

For 10.2.2 we did not have this issue.  With 10.3.1, we got this error message when attempting to generate a token with HTTP Referer and Expiration filled in when manually requesting token from:

https://local_machine_name:6080/arcgis/tokens/

Invalid request

Usage: https://webserver_domain/arcgis/tokens?request=gettoken&username=username&password=password&

Usage: https://webserver_domain/arcgis/tokens/generateToken?username=username&password=password&

Usage: https://webserver_domain/arcgis/tokens/gettoken.html

ESRI support said:

  • Credentials are needed in 10.3.1 to generate the token.  The id and pw should be your primary site administrator account.
  • Also, in GeoEvent Processor - Site > Data Stores, when trying to register your new token, you may need to provide the URL: in FQDN format.  Note:  We only provide the machine name without the domain and it worked fine.
  • And as others have said ESRI support also said this error message can be due to webadapter issue.
0 Kudos
StefanUseldinger
Occasional Contributor II

I solved this issue by setting the correct Content-Type in den HTTP Request Header.

0 Kudos