I have created a geoprocessing service using Python and the ArcREST API that manipulates data in a secured service.
The problem is that when i try to have the user select a layer on the map (if it comes from a secured feature service). I get the following error:

I can get around this by having the user supply the URL to the service as a string. The script generates a token to use the apply edits feature of the REST API, but if I don't use a string parameter the script crashes immediately, even though the token is generated prior to the parameter ever being used. However, users rarely know the URL of the services their editing and want to be able to select things straight off of the map. This is a requirement of the client for whom I am building this.
When I use an unsecured service, the parameter comes through in the script as a string value (the URL of the service) and the script runs just fine.
Any ideas???
Thank you!!!