Pass Token to World Geocode Service - Invalid Token

902
5
Jump to solution
10-21-2013 05:59 PM
KeithSandell
New Contributor III
I have to use python and the REST API to geocode records against the ArcGIS Online World Geocoding service.

I can successfully request a token, but when the token is passed as part of the geocode request I get an error message returned that it is invalid, with no other information. I've tried passing it as a url parameter and/or a header and both.

If I omit the the token and the forStorage parameter I can successfully obtain a response as expected, but I can't use this method because I need to store the results.

The server that the python script is running on is a VM in a Microsoft hosting environment. The token request requires the referring "website". In this case it is not a website, but a server so I am substituting the IP address of the server, assuming this is how the geocoding service is validating the geocode request. I've tried both the internal and external IP addresses, but neither have worked.

The docs recommend not using the REST API, but I have no choice in this case.

I need to know more about how the geocoding service is validating the token and how it interprets "websites" or in my case an ip address.

Any help would be much appreciated.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MikeMinami
Esri Notable Contributor
I am not a coder, but I  asked around and got this response...hopefully it helps.

He needs to make sure that the http referer passed along with the geocode request is the same url he used when generating the token.


thanks,

Mike

View solution in original post

0 Kudos
5 Replies
MikeMinami
Esri Notable Contributor
You might try cross posting in the Python or arcgis REST forums

http://forums.arcgis.com/forums/117-Python
http://forums.arcgis.com/forums/227-ArcGIS-REST-API

Thanks,

Mike
0 Kudos
KeithSandell
New Contributor III
Thanks, I did that.

Although I'm not sure anyone outside of Esri is going to be able to answer this...
0 Kudos
MikeMinami
Esri Notable Contributor
I am not a coder, but I  asked around and got this response...hopefully it helps.

He needs to make sure that the http referer passed along with the geocode request is the same url he used when generating the token.


thanks,

Mike
0 Kudos
KeithSandell
New Contributor III
Just arrived at that conclusion. I assumed that python was passing a referer with the request. After I added it manually all was good.
0 Kudos
GeoffreyDrower
New Contributor
Did this end up working for you? What format did you use for your referrer.. I'm having similar issues, but even when I pass along a referrer in the token request and geocode request... it still gives me 'Invalid Token'
0 Kudos