I got a Spark working with the Relay sketch. I performed the curl commands from my Mac, without any issue, and was able to turn on/off the LEDs connected to the relays. However, when I transplanted the exact same command to another computer (server at Amazon), I got
{
"code": 400,
"error": "invalid_grant",
"error_description": "The access token provided is invalid."
}
and I can’t find how to change the authorization token to allow the new server to access the relays.
The access token can be found (and reset) on the settings page in the build IDE at spark.io/build
Random question: are you sure that server supports curl?
Yes, it supports curl, otherwise I could not get the JSON encoded answer back. I realize I can reset the token, but it works just fine from my Mac, but not the Ubuntu 14.04 system at AWS. I thought there might be something system specific in the token, like a dependency on the source IP address.
That was interesting. Using the form -d access_token=NUMBER, it worked. I had used the -H form because the documentation said it ‘always works’, but it did not. (in retrospect, I think it means ‘works for both GET, POST, and PUT, not is more reliable’).
I’m not sure what the issue is there, but thanks for helping me get it working!
Ok, I haven’t seen that before. It seems it was a paste error. I copy/pasted it with my mouse from one terminal window to the other, and it changed. Sorry for the mistake