Having an issue subscribing to SONOS Control events. This is in production code that has not been modified for a long time (over a year).
SONOS web server is returning access denied (403).
For example, when subscribing for playback metadata:
https://api.ws.sonos.com/control/api/v1/groups/RINCON_xxx:yyy/playbackMetadata/subscription
Returns:
System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at CT.Sonos.Control.SonosControlApi.GetResponse(HttpWebRequest request)
CT.Sonos.Control.SonosControlApi: 2023-03-30 11:34:52,128 [44] ERROR TransactJson: POST https://api.ws.sonos.com/control/api/v1/groups/RINCON_xxx:yyy/playbackMetadata/subscription content=[] : re_entrant=False, ErrorCode=[BAD_JSON_RESPONSE], Reason=[<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access "http://api.ws.sonos.com/control/api/v1/groups/RINCON&#RINCON_xxx:yyy#47;playbackMetadata/subscription" on this server.<P>
Reference #18.27761cb8.1680190492.2d72611
</BODY>
</HTML>
], X-Sonos-Type=[]
NOTE: Removed device info from message
I was experiencing the same issue (despite properly being OAuth authenticated against a user's Sonos account, we got back a 403 Forbidden response when trying to subscribe to a Group's events).
Our developer advocate at Sonos investigated and reported back: "This was due to an issue on our side which made its way into production on March 29th. It has been remedied now, so please try again and let us know if you are still having any issues." As of April 5, 2023 I am no longer experiencing an issue when subscribing to Group events.