After the Core successfully handshakes with the Cloud, it announces its device ID on the local subnet with a CoAP message. The UDP multicast address is 220.127.116.11 port 5683. The UDP payload is 19 bytes, the last 12 of which are the device ID.
You can get the access token by sending a POST request to https://api.spark.io/oauth/token — this will currently destroy your existing token and return a new one. I’m working on allowing multiple tokens this week. We currently only support OAuth2 password grant type. A client must be sent in HTTP Basic auth, but it does not matter what the client credentials are—just use client ID spark, password spark. Example request (ignoring TLS):
POST /oauth/token HTTP/1.1
Authorization: Basic c3Bhcms6c3Bhcms=
You can generate this in your terminal with curl like this:
curl -v -u spark:spark -d grant_type=password -d email@example.com -d password=A3ddj3w https://api.spark.io/oauth/token
The response will look like this:
Once you have an access token, you can get a list of devices owned by that user with a
GET /v1/devices request too, which is more reliable than being there to catch the UDP multicast.