When to use authorization in a skill

When accounts are linked, the skill can access information about user devices on your service and manage them.

Linking accounts is always required to launch smart home skills. The user can't launch a skill until they connect their Yango account to the account in the smart home management system of the skill owner (usually the device manufacturer).

When to require authorization

Unlike generic skills, for smart home skills, you don't need:

  • To consider when to request authorization. The  Yango Play app automatically does it before starting the skill.

  • To check whether the user is signed in when processing requests. Yango Dialogs do this for you. If the user logs out of their account, requests stop being sent to devices. Yasmina asks the user to sign in again.

Example

For example, to control Aqara smart devices with voice, the user needs to:

  1. Download the Aqara Home app from Google Play or the App Store.
  2. Log in to the app, then add and configure Aqara smart devices.

    Home management screen in the Aqara Home app
    Add device screen in the Aqara Home app
    Home management screen in the Aqara Home app
    Add device screen in the Aqara Home app
  3. Open the  Yango Play app and tap Plus in the upper-right corner.
  4. Choose Smart home device, and then select an Aqara skill.
  5. Tap Link to Yango. This redirects to the Aqara Home authorization page that was specified in the skill settings in Authorization URL.

  6. Log in to the Aqara Home app with the account from Step 2 and tap Continue to confirm Yango Smart Home access to the Aqara account. Here's what happens according to the OAuth 2.0 specification:
    1. The Aqara skill authorization server calls the redirect URL (redirect endpoint) that returns an authorization confirmation code (authorization code grant).
    2. The Yango Smart Home server sends a request to Get token URL using the authorization code.
    3. The Aqara skill authorization server sends the user's OAuth token to Yango Smart Home.
    You can learn more about how authorization works in a skill here.

When the user taps Update device list, the Yango Smart Home server sends a request with the issued OAuth token to the Aqara skill server on behalf of the user. All devices from the Aqara Home app are added to the  Yango Play app device list.

After that, the user can just ask Yasmina to close the curtains, turn off the lights, or tell them the temperature or humidity in the room.