oauthsonos

Issue requesting token from Sonos api in oauth process


Problem I am trying to implement the Sonos Authorization API as I am trying to build a small IoT device I want to use as a remote but I am facing difficulties with the oauth process.

I did the following

  1. Create a Sonos dev-account and create credentials

  2. Open the "Create Authorization Code" in the browser and enter my Sonos credentials. In this step I get redirected to the redirect url as expected (I used requestbin.com and postb.in to get started)

  3. Try to create the token but I get a client_invalid error which is supposed to mean the authorization code is incorrect

What I noticed As I havent implemented any custom code yet I am not sure what I am doing wrong. I noticed the authorization codes I receive (e.g. ZGyr3PrM) are much shorter in comparison to the examples (e.g. f10072fa6-2134-4fe1-93fd-ca5b9cffa738).

Do you have any ideas how to fix this or did anyone else have the same issues?

Thanks for your support Felix


Solution

  • I found the solution to my problem:

    The example how to add the authorization in the documentation to create the token ist not correct.

    It should be

    Authorization: Basic {Base64 clientid:secret}

    instead of

    Authorization: Basic {Base64 clientid and secret}