DW Cloud OAuth API Overview
-----------------------------------
Related Digital Watchdog VMS Apps: DW Spectrum IPVMS
Last Edit: November 21, 2024
-----------------------------------
Overview
This article will go over the steps for integrating with the DW Spectrum OAuth API. Integrations that use the Cloud API to fetch data from a user's DW Spectrum Cloud System will only be able to do so after a user is authenticated. Any developer with JavaScript experience (especially with using Fetch API or similar third-party alternatives) should have the necessary skills to use the DW Spectrum OAuth API.
There are several benefits to using OAuth over the much less secure Basic Authentication which exposes the user and password:
- More secure as your password is never exposed after you get the access codes (it is similar to how Social Auth works).
- Two-factor authentication (2FA) is supported.
- Authorize other apps to use the Cloud API for you.
Related Articles
Prerequisites
- Preferred local webhost tool (our examples use the one built into Python 3.x)
- Your preferred JavaScript editor
- Online DW Spectrum System connected to DW Cloud
Writing Code and Testing the Integration
To write code and test the integration:
- Create a folder.
- Create an empty index.html file in the folder.
- Open the oauth_demo.html file in your preferred JavaScript editor and write your code.
- Host the oauth_demo.html file on a local web server for testing purposes.
a. Open CMD/terminal and navigate to the folder created in step 2.
a. Run the command: python3 -m http.server 7002 - Open oauth_demo.html page in a browser (https://localhost:7002/oauth_demo.html)
API Example for Creating a Web Application
- Your web app must redirect the user to the DW Cloud authorization page.
- Example: https://dwspectrum.digital-watchdog.com//authorize?redirect_url=https://{your app}
- Then that page will return a code in the query parameters of the redirect URL.
- Example: https://dwspectrum.digital-watchdog.com/?code={some code}
- The code should be used in the following way to get access and refresh codes
a. Insert request for tokens. - Refresh code can be used to obtain an access code or a new refresh token
a. Read about scope in the How scope works section.
b. Insert request for new code or tokens.
For More Information or Technical Support
DW Technical Support: 866.446.3595 (option 4)
https://www.digital-watchdog.com/contact-tech-support/
______________________________________________________________________________
DW Sales: 866.446.3595 [email protected] www.digital-watchdog.com