Onboarding Api with OAuth and physical button
-
First you need to locate the IP of your gateway using either your router or scan using avahi-browse
#> avahi-browse -ar | grep gw2-.* -A3
This will list all mDNS records that have gw2- Look for the ipv4.
-
Transfer the code to target GW
First check that you can access the gateway with ssh. #> ssh root@
There is no password set for root.
#> cd <onboarding_poc_git> #> scp -r nodeJS root@:/usr/local/
-
Now all files in the folder nodeJS are located on the gateway filesystem under /usr/local/nodeJS
-
Start the server #> ssh root@ root@gw2-0ac3d654c2b4:
# cd /usr/local/nodeJS root@gw2-0ac3d654c2b4:# npm install root@gw2-0ac3d654c2b4:~# npm start
-
Install postman on the host and start it
-
Then create a GET request with this link:
http://:3000/oauth/authorize?audience=homesmart.local&response_type=code&code_challenge=O7MvFG4EiHPxwqkK8P1gXtHs7WRAahzsgBMmgNMbwLk&code_challenge_method=S256
-
Send it and check the return payload. It Should look like this:
{ "auth_code": "" }