getDeviceLinkCode
We recommend that you no longer use getDeviceLinkCode
.
If your integration uses getDeviceLinkCode
, it will continue to work. For new integrations, we recommend that you upgrade to getAppLink. See Add authentication for details.
Sonos makes this request on your secure (HTTPS) endpoint.
Request parameters
Name | Type | Description |
---|---|---|
householdId | string | The Sonos household ID requesting the link code. |
Response
Include the response in a deviceLinkCodeResult
inside a getDeviceLinkCodeResponse
element.
Name | Type | Description |
---|---|---|
regUrl | string | A URL that a user should navigate to in order to complete device authentication. Be sure that this page handles script injection. |
linkCode | string | The linkCode generated for device authentication. |
showLinkCode | boolean | Whether or not the link code should be displayed in the Sonos application UI. |
linkDeviceId | string | (Optional) A token that is hidden from the user to prevent token phishing. |
Sample request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.sonos.com/Services/1.1">
<soapenv:Header>
<ns:credentials>
<ns:deviceId>00:00:00:00:00</ns:deviceId>
<ns:deviceProvider>Sonos</ns:deviceProvider>
</ns:credentials>
</soapenv:Header>
<soapenv:Body>
<ns:getDeviceLinkCode>
<ns:householdId>Sonos_abc123</ns:householdId>
</ns:getDeviceLinkCode>
</soapenv:Body>
</soapenv:Envelope>
Sample response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getDeviceLinkCodeResponse xmlns="http://www.sonos.com/Services/1.1">
<getDeviceLinkCodeResult>
<regUrl>https://musicService.example.com/oauth?code=KJ12U</regUrl>
<linkCode>KJ12U</linkCode>
<showLinkCode>false</showLinkCode>
<linkDeviceId>123AQ311</linkDeviceId>
</getDeviceLinkCodeResult>
</getDeviceLinkCodeResponse>
</soap:Body>
</soap:Envelope>
Updated about 1 year ago