diff --git a/content/arduino-cloud/07.api/02.arduino-iot-api/arduino-iot-api.md b/content/arduino-cloud/07.api/02.arduino-iot-api/arduino-iot-api.md index 6f10124cff..f899c6af1a 100644 --- a/content/arduino-cloud/07.api/02.arduino-iot-api/arduino-iot-api.md +++ b/content/arduino-cloud/07.api/02.arduino-iot-api/arduino-iot-api.md @@ -78,13 +78,28 @@ Before we can make requests to the API, we will need to generate an **access tok ![Authorization (step 1).](assets/postman-1.png) -Now, click on the **"Advanced Options"** tab, and add `https://api2.arduino.cc/iot` to the **"Audience"** field. +- Set **"Auth Type"** to **"OAuth 2.0"** with a **"Request Header"** +- Select **"Token Name"**, and **"Bearer"** + +Then scroll down to the **"Configure New Token"**. ![Authorization (step 2).](assets/postman-2.png) -Finally, click on the **"Get New Access Token"**. +- Set **"Grant Type"** to **"Client Credentials"** and set `https://api2.arduino.cc/iot/v1/clients/token` for the **"Access Token URL"**. +- Add your Client ID & Client Secret (obtained in Arduino Cloud API Keys / Devices). +- Set the **"Client Authentication"** to **"Send client credentials in body"**. + +Then, click on the **"Advanced"** tab, and populate the fields according to the image below: + +![Authorization (step 3).](assets/postman-3.png) + +- **Key** is set to `audience` +- **Value** is set to `https://api2.arduino.cc/iot` +- **Send In** is set to **Request Body** + +Finally, click on the **"Get New Access Token"**. You should get a pop-up window. On success, it should look like this: -![Token button.](assets/access-token.png) +![Authentication complete.](assets/auth-complete.png) You now have an access token that has an expiry of `300` seconds, and we can make requests to the API. diff --git a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/access-token.png b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/access-token.png deleted file mode 100644 index b35b4ba30f..0000000000 Binary files a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/access-token.png and /dev/null differ diff --git a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/auth-complete.png b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/auth-complete.png new file mode 100644 index 0000000000..f474e66ba0 Binary files /dev/null and b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/auth-complete.png differ diff --git a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-1.png b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-1.png index 9177417281..12963da880 100644 Binary files a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-1.png and b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-1.png differ diff --git a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-2.png b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-2.png index 206823c8c6..b9ed4d700f 100644 Binary files a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-2.png and b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-2.png differ diff --git a/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-3.png b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-3.png new file mode 100644 index 0000000000..762442cb22 Binary files /dev/null and b/content/arduino-cloud/07.api/02.arduino-iot-api/assets/postman-3.png differ