I am not familiar with the JavaScript API but I have used the REST API itself.
You might try passing the token as a URL parameter, i.e. &token=#####. That is how you pass it in REST.
{
"baseMap": {
"baseMapLayers": [
{
"id": "World_Street_Map_1271",
"opacity": 1,
"url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",
"visibility": true
}
],
"title": "World_Street_Map"
},
"operationalLayers": [
{
"id": "USA_States_Generalized_9320",
"layerDefinition": {
"drawingInfo": {
"renderer": {
"symbol": {
"color": [
255,
214,
180,
0
],
"outline": {
"color": [
251,
164,
93,
255
],
"style": "esriSLSSolid",
"type": "esriSLS",
"width": 0
},
"style": "esriSFSSolid",
"type": "esriSFS"
},
"type": "simple"
}
}
},
"mode": 1,
"opacity": 1,
"popupInfo": {
"description": null,
"fieldInfos": [
{
"fieldName": "FID",
"format": {
"digitSeparator": true,
"places": 0
},
"isEditable": true,
"label": "FID",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "STATE_NAME",
"format": null,
"isEditable": true,
"label": "STATE_NAME",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "SUB_REGION",
"format": null,
"isEditable": true,
"label": "SUB_REGION",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "STATE_ABBR",
"format": null,
"isEditable": true,
"label": "STATE_ABBR",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "POP2010",
"format": {
"digitSeparator": true,
"places": 0
},
"isEditable": true,
"label": "POP2010",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "POP10_SQMI",
"format": {
"digitSeparator": true,
"places": 2
},
"isEditable": true,
"label": "POP10_SQMI",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "POP2012",
"format": {
"digitSeparator": true,
"places": 0
},
"isEditable": true,
"label": "POP2012",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "POP12_SQMI",
"format": {
"digitSeparator": true,
"places": 2
},
"isEditable": true,
"label": "POP12_SQMI",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
{
"fieldName": "WHITE",
"format": {
"digitSeparator": true,
"places": 0
},
"isEditable": true,
"label": "WHITE",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
},
// omit some other fieldNames to shorten the text
,
{
"fieldName": "SQMI",
"format": {
"digitSeparator": true,
"places": 2
},
"isEditable": true,
"label": "SQMI",
"stringFieldOption": "textbox",
"tooltip": "",
"visible": true
}
],
"mediaInfos": [],
"showAttachments": true,
"title": "USA_States_Generalized: "
},
"title": "USA_States_Generalized - USA_States_Generalized",
"url": "http://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_States_Generalized/FeatureServer/0",
"visibility": false
}
],
"version": "1.9.1"
}
It looks to me like your token worked fine.
Here is the documentation on the REST API for Item:
http://resources.arcgis.com/en/help/arcgis-rest-api/02r3/02r3000000ms000000.htm
It looks to me like it is doing what it was designed to do. I think that your question is which API and arguments do you use to do the thing that you want to do. Other than studying the API, one trick that I sometimes use is to run Fiddler and then use some ESRI tool which does what I want, e.g. ArcMap, and then look at the HTTP traffic in order to understand the API and arguments that it is using. For example, can you edit the web map using ArcGIS Online tools? If so then use Fiddler to see what it is doing under the covers.
Best of luck!