Might be a problem due to the referer (I am not sure which referer you set in your token request).
Instead of generating a token associated to a referer, you can try to generate a token associated to your ip address.
Something like:
https://www.arcgis.com/sharing/generateToken?f=json&username=myusername&password=mypassword&client=r...
I did try what you suggested (space added so the full string can be shown):
h t t ps://www.arcgis.com/sharing/generateToken?f=json&username=myusername&password=mypassword&client=requestip
but got an effor message:
{"error":{"code":400,"message":"Unable to generate token.","details":["'referer' must be specified."]}}
Strange! You got an error as if the option client=requestid was missing.
Do you get that error when clicking on this link : https://www.arcgis.com/sharing/generateToken?f=json&username=myusername&password=mypassword&client=r...
Yes:
{"error":{"code":400,"message":"Unable to generate token.","details":["Invalid username or password."]}}
The problem was I changed "requestip" to my actual ip address.
My assumption is that token generated this way is bound to the ip and won't work if the map request is sent from a different IP?
Do you have any theory why the token generated using referer=MyToken won't work?
If you are using using IE, that should work.
For example, you can try to generate a token for the referer=http://<yourserver>