Homey Apps SDK
📖 Apps SDK Reference🌍 Web API🛠 Developer Tools
  • Welcome to the Apps SDK documentation đź‘‹
  • The Basics
    • Getting Started
      • Homey CLI
    • App
      • Manifest
      • Internationalization
      • Permissions
      • Persistent Storage
    • Drivers & Devices
      • Pairing
        • System Views
          • Devices List
          • Add Devices
          • OAuth2 Login
          • Credentials Login
          • Pincode
          • Loading
          • Done
        • Custom Views
      • Capabilities
      • Energy
      • Settings
      • Best practices
        • Lights
        • Window coverings
        • Battery status
    • Flow
      • Arguments
      • Tokens
    • Widgets
      • Settings
      • Styling
      • Debugging
  • Wireless
    • Wi-Fi
      • Discovery
    • Bluetooth LE
    • Z-Wave
    • Zigbee
    • 433 MHz
    • Infrared
    • Matter
  • Cloud
    • OAuth2
    • Webhooks
  • App Store
    • Publishing
    • Guidelines
    • Verified Developer
    • Updating
  • Advanced
    • Custom Views
      • App Settings
      • Custom Pairing Views
      • HTML & CSS Styling
    • Web API
    • Images
    • LED Ring
    • Homey Compose
  • Guides
    • Homey Cloud
    • Breaking Changes
    • Tools
      • Bluetooth LE
      • Zigbee
      • TypeScript
    • Using ESM in Homey Apps
  • Upgrade Guides
    • Homey v6.0.0
    • Upgrading to SDK v3
      • Zigbee Apps
    • Device Capabilities
Powered by GitBook
On this page
  • Introduction
  • Homey OAuth2App

Was this helpful?

  1. Cloud

OAuth2

Authorise Homey to use a Web API with OAuth2.

PreviousMatterNextWebhooks

Last updated 11 months ago

Was this helpful?

Introduction

OAuth2 is an authentication standard used often by smart home manufacturers for delegating user access to their Web API. You might have previously encountered this as a "Candy Crush wants access to your Facebook account"-type dialog.

Usually, a developer registers an OAuth2 client on a developer-specific website owned by the manufacturer. Often a Name, Redirect URL, Scopes and/or an Image have to be provided.

Homey OAuth2App

This module does all the heavy lifting related to OAuth2, such as logging in, obtaining an access token, refreshing tokens and making API calls.

Almost always, the Redirect URL has to be entered beforehand for security reasons. Homey is behind a NAT, however, and thus does not have a static URL available to redirect to. For this scenario, you can use . This method generates a unique URL to redirect the user to, which passes the resulting code parameter —which you can then swap for an access token— back to your app.

You can view working examples of Homey Apps that use OAuth2 at: , , and

The recommended way to create a Homey app for an OAuth2 Web API is by using .

Because no API is the same, the module has been designed specifically to be extended to fit your Web API. Even if your device's Web API differs from the , methods can be overloaded to change behaviour.

ManagerCloud#createOAuth2Callback()
https://github.com/athombv/nl.thermosmart-example
https://github.com/athombv/nl.eneco.toon-example
https://github.com/athombv/io.nuki-example 
homey-oauth2app
OAuth2 specification
Homey's OAuth2 Consent Dialog