Connect a Thing to the Gateway
This example connects a Thing to the Gateway. When the Thing has connected, it can authenticate to AM and request an access token. The source code for this example is in /path/to/iot-edge/examples/thing/simple/main.go
.
Before you run the example, register the Thing manually (using gateway-thing
as the Thing's ID). Then, run the thing/simple
example to connect the Thing to the Gateway:
cd /path/to/iot-edge ./run.sh example "thing/simple" \ -name "gateway-thing" \ -url "coap://:5683" \ -keyfile "./examples/resources/eckey1.key.pem" \ -audience "/"
Creating Thing gateway-thing... Done Requesting access token... RequestAccessToken response: { "access_token":"vHJDYCBkOjih90PWGAw0KcsCzpU", "scope":"publish", "token_type":"Bearer", "expires_in":3599 } Done Access token: vHJDYCBkOjih90PWGAw0KcsCzpU Expires in: 3599 Scope(s): [publish] ______ __ __ /\ __ \ /\ \/ / \ \ \/\ \ \ \ _"-. \ \_____\ \ \_\ \_\ \/_____/ \/_/\/_/