Hi,
While implementing the route and direction tutorial in my application, I am getting below error in the console.
You are currently signed in as: '*****'. You do not have access to this resource: https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve"
name: "identity-manager:not-authorized"
Hi Sahil,
When looking at the above link, do you see the following ifnormation?
Error: The administrator has disabled the Services Directory.
Code: 403
If os, this is the expected behavior of the services. While we are not allowed to browse the REST directory of the services, we can still send requests to the API through the URL. Here is an example pulled from the documentation:
https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve? stops={"features":[{"geometry":{"x":-122.473948,"y":37.7436}, "attributes":{"Name":"Office","Attr_TravelTime":0}},{"geometry":{"x":-122.439613,"y":37.746144}, "attributes":{"Name":"Store 1","Attr_TravelTime":25}},{"geometry":{"x":-122.488254,"y":37.754092}, "attributes":{"Name":"Store 2","Attr_TravelTime":20}},{"geometry":{"x":-122.44915,"y":37.731837}, "attributes":{"Name":"Store 3","Attr_TravelTime":30}},{"geometry":{"x":-122.46441,"y":37.774756}, "attributes":{"Name":"Store 4","Attr_TravelTime":25}},{"geometry":{"x":-122.426896,"y":37.769352}, "attributes":{"Name":"Store 5","Attr_TravelTime":20}},{"geometry":{"x":-122.473948,"y":37.7436}, "attributes":{"Name":"Office","Attr_TravelTime":0}}]}&findBestSequence=true&preserverFirstStop=true& preserveLastStop=true&returnStops=true&returnDirections=true&returnRoutes=true&f=json&token=<yourToken>
This will return a response, provided you provide a valid ArcGIS Online token as a URL parameter.
Does this address the situation you are encountering?
Thanks,
Calvin
Hi,
Thanks for the reply!
Just a small doubt, from where we can get our arcgis online token?
Thanks,
Sahil
Hi Sahil,
You can generate a token for ArcGIS Online through the following URL: https://www.arcgis.com/sharing/generateToken
In order to pass your username and password to the request, you will need to use something like Postman. Here is a good blog that explains this process:
https://community.esri.com/t5/arcgis-online-blog/generate-a-token/bc-p/890236
Thanks,
Calvin
Thanks trying this solution only.
Hi Calvin,
I generated the token via developer tools option. but in the console still its saying the invalid token.
Below is the error which I am getting:
polyfills.js:10456 Unhandled Promise rejection:
s {name: "request:server", details: {…}, message: "Invalid Token"}
details:
getHeader: e=>s.headers.get(e)
httpStatus: 498messageCode: undefinedmessages: []requestOptions:
{query: {…}}ssl: falsesubCode: undefined
url: "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve"
__proto__: Objectmessage: "Invalid Token"name: "request:server"__proto__: s ; Zone: <root> ;
Task:
Promise.then ; Value: s {name: "request:server", details: {…}, message: "Invalid Token"} undefined
PFB the code snippet
Hi Calvin,
While implementing the map with access token, i am getting the below error:
message: "Invalid Token"..
and when I am trying to implement it without using access token then I am getting the same error message as below:
"You are currently signed in as: 'Sahil_28'. You do not have access to this resource: https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve"
Received this same error for a Portal rest service - simply changed permissions to private and back to organizationally shared and fixed. Strange Portal issue