第 2 のユーザー認証では、音声コマンドに 2 つ目のセキュリティを追加できます。これにより、セキュリティ カメラの電源を切る、ドアを開けるといった特定の操作のセキュリティを強化できます。2 次的なユーザー確認は、特定のデバイス トレイトに関連付けられていないため、いつ Google Assistant issue a challenge. For example, you can choose to issue a challenge for the OnOff trait for a security camera, but not issue a challenge for the OnOff trait for a light. You can also have Assistant issue challenges in certain situations for the same action. For example, you can request that Assistant issue a challenge request to open a door if an NFC keyfob is not in the proximity of that door, but not issue a challenge if the keyfob is present. を使用するのかを決定できます。
Assistant では、明示的な確認応答と個人識別番号(PIN)の 2 種類のチャレンジを発行できます。これにより、Assistant からアクションに返送される QUERY
インテントと EXECUTE
インテントにチャレンジ ブロックが追加され、challengeNeeded
エラー レスポンスが受け入れられます。次に、Assistant は、チャレンジ ブロックのチャレンジ データを使用して、インテント リクエストをアクションに返します。その後、チャレンジ データを検証して、ユーザーが正しいセキュリティ レスポンスを提供したかどうかを判断できます。
Assistant はチャレンジを発行するためにダイアログを使用しますが、音声以外のサーフェスで Assistant を使用すると、PIN と確認が画面上で行われます。
サポートされているデバイスタイプ
Secondary User Verification はすべてのデバイスタイプでサポートされています。
サポートされているデバイス トレイト
Secondary User Verification はすべてのデバイス トレイトでサポートされています。
サポートされているチャレンジの種類
Secondary User Verification がサポートされているチャレンジの種類は以下のとおりです。
- チャレンジなし - Secondary User Verification チャレンジを使用しないリクエストとレスポンス。
- ackNeeded - 明示的な確認応答(はい / いいえ)を必要とするセカンダリ ユーザーの確認。トレイトの状態をレスポンスのフィードバックとして使用することもできます。このチャレンジ タイプは、セキュリティ デバイスとトレイトにはおすすめしません。
- pinNeeded - 個人識別番号(PIN)を必要とするセカンダリ ユーザー検証。これはセキュリティ デバイスとトレイトに最適です。
チャレンジなし
この例では、照明をオンにするためのチャレンジを伴わずに、EXECUTE
リクエストとレスポンスを正常に実行しています。
ユーザー | 照明をつける。 |
Google Assistant | 3 個のライトを点灯します。 |
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.OnOff", "params": { "on": true } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "SUCCESS", "states": { "on": true, "online": true } }] } }
ackNeeded
トレイトの複数の状態または単純な確認応答を使用できる 2 番目のユーザー確認認証。
ackNeeded
チャレンジには次の種類があります。
単純な ackNeeded
以下の例は、照明を暗くするために ackNeeded
チャレンジを発行してその確認を得る単純なリクエストとレスポンスを示します。
ユーザー | リビングの照明を暗くして。 |
Google Assistant | リビングの照明を暗くします。本当によろしいですか? |
ユーザー | はい。 |
Google Assistant | リビングの照明を暗くして |
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.BrightnessAbsolute", "params": { "brightness": 12 } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "ERROR", "errorCode": "challengeNeeded", "challengeNeeded": { "type": "ackNeeded" } }] } }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.BrightnessAbsolute", "params": { "brightness": 12 }, "challenge": { "ack": true } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "SUCCESS" }] } }
トレイトの状態を伴う ackNeeded
トレイトの状態を使用できるセカンダリ ユーザー確認認証。
たとえば、TemperatureSetting トレイトを使用していて、thermostatMode
と thermostatTemperatureSetpoint
の両方が設定されている場合、Assistant はエアコンの暖房温度を 28 度に設定してもよろしいですか?と尋ねることができます。
レスポンスに状態を含めると、特定のリクエストに基づいて Assistant が特定のアクションを実行できます。
以下のトレイトと状態は、トレイトの状態を指定して ackNeeded
をサポートします。特定のトレイトのリストは、すべての状態がサポートされていることを示します。
- ArmDisarm
currentArmLevel
currentStatusReport
- Fill
- LockUnlock
- OnOff
on
- OpenClose
- Scene
- TemperatureSetting
thermostatMode
thermostatTemperatureSetpoint
thermostatTemperatureSetpointHigh
thermostatTemperatureSetpointLow
この例では、トレイトの状態を使用する ackNeeded
チャレンジのリクエストとレスポンスを示します。エアコンのモードを暖房に変え、温度を 28 度に設定します。次に、28
の thermostatTemperatureSetpoint
がレスポンスで状態として返されるため、暖房をつけて温度を 28 度に設定する確認をユーザーに求めます。
ユーザー | エアコンを暖房に設定して。 |
Google Assistant | エアコンの暖房を 28 度に設定してもよろしいですか? |
ユーザー | はい。 |
Google Assistantnt | エアコンの暖房を 28 度に設定します。 |
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.TemperatureSetting", "params": { "thermostatMode": "heat" } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "ERROR", "states": { "thermostatMode": "heat", "thermostatTemperatureSetpoint": 28 }, "errorCode": "challengeNeeded", "challengeNeeded": { "type": "ackNeeded" } }] } }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.TemperatureSetting", "params": { "thermostatMode": "heat" }, "challenge": { "ack": true } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "SUCCESS", "states": { "thermostatMode": "heat", "thermostatTemperatureSetpoint": 28 } }] } }
pinNeeded
セキュリティ デバイスには pinNeeded
チャレンジを使用することをおすすめします。
この例では、pinNeeded
チャレンジを使用した最初のリクエストとレスポンスを示します。この例では、pinNeeded
チャレンジを含むレスポンスを返すため、Assistant から PIN が要求されます。この時点で、ユーザーは誤った PIN または有効な PIN を提供できます。
正しくない PIN が提供された場合と有効な PIN が提供された場合のリクエストとレスポンスの例:
ユーザー | ドアのロックを解除します。 |
Google Assistant | セキュリティ コードを教えてください。 |
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.LockUnlock", "params": { "lock": false } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "ERROR", "errorCode": "challengeNeeded", "challengeNeeded": { "type": "pinNeeded" } }] } }
正しくない PIN
次の例は、challengeFailedPinNeeded
チャレンジを使用したリクエストとレスポンスを示しています。このチャレンジは、最初の pinNeeded
チャレンジに失敗した後に使用する必要があります。
challengeFailedPinNeeded
型が返されると、Assistant はセキュリティ コードを再度要求します。ユーザーが何度も失敗した場合は、tooManyFailedAttempts
エラー レスポンスを返すことができます。エラー レスポンスをご覧ください。
ユーザー | 333222 |
Google Assistant | セキュリティ コードが正しくありません。 セキュリティ コードを教えてください。 |
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.LockUnlock", "params": { "lock": false }, "challenge": { "pin": "333222" } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "ERROR", "errorCode": "challengeNeeded", "challengeNeeded": { "type": "challengeFailedPinNeeded" } }] } }
有効な PIN
以下の例は、有効な PIN が提供された場合のリクエストとレスポンスを示します。
ユーザー | 333444 |
Google Assistant | ドアのロックを解除します。 |
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.LockUnlock", "params": { "lock": false }, "challenge": { "pin": "333444" } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "SUCCESS", "states": { "isLocked": false, "isJammed": false } }] } }
ユーザー | リビングの照明を暗くして。 |
Google Assistant | セキュリティ コードを教えてください。 |
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.EXECUTE", "payload": { "commands": [{ "devices": [{ "id": "123" }], "execution": [{ "command": "action.devices.commands.BrightnessAbsolute", "params": { "brightness": 12 } }] }] } }] }
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "commands": [{ "ids": ["123"], "status": "ERROR", "errorCode": "challengeNeeded", "challengeNeeded": { "type": "pinNeeded" } }] } }
Error responses(エラー応答)
以下は、レスポンスで返される可能性があるエラーコードです。
challengeFailedNotSetup
- この操作にはセキュリティ コードが必要ですが、デバイスのアプリにセキュリティ コードが設定されていません。tooManyFailedAttempts
- 試行回数が上限を超えました。デバイスのアプリでこの操作を完了してください。pinIncorrect
- セキュリティ コードが正しくありません。userCancelled
- わかりました。
エラーと例外の全リストをご覧ください。