Hello, my mapping application uses a GP service to save some info to a .txt located on the server. The GP service is secured through Portal. I was able to save data via the GP service rest endpoint without any issues. However, when I used JavaScript API to do that (codes are below) in WAB, the Modified Date of the file was updated but no data was saved. "Error: token required..." was thrown in Concole. I guess this was related to the secured GP service. How to add a credential to the Geoprocessor? Thanks for your help!
Solved! Go to Solution.
Alex,
When your register your app you get a appid and client secret:
https://developers.arcgis.com/applications/#/new/
You are probably better off using the username and password parameters in the ServerUrl instead, if you don't know about the clientSecret.
Alex,
I would setup the proxy for that url in your proxy.config and set the proxy rule in your apps main config.
Use proxy—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
Setting up a proxy with Web AppBuilder Developer Edition | Support Services Blog
Thank you Robert always. I set it up like following, but threw "SyntaxError: Unexpected token <". I used Application ID for the clientId. Where to get the clientSecret?
config.json
proxy.config
Alex,
When your register your app you get a appid and client secret:
https://developers.arcgis.com/applications/#/new/
You are probably better off using the username and password parameters in the ServerUrl instead, if you don't know about the clientSecret.