Tomasz
Tomasz

Reputation: 3

SoundCloud - 401 Unauthorized Error - Authenticating without the SoundCloud Connect Screen

I'm new to SoundCloud and have been following the developers documentation in Authenticating without SoundCloud screen.

However when my application sends the request I recieve a 401 Unauthorized error. In the documentation it specifies to check that the client_id or access_token is not missing and its not.

I can't figure out what is the issue here. I've checked the following:

  1. Register Application - Check
  2. Pass client_id and client_secret - Check

Here is my code that calls to the sound cloud server:

response = (HttpWebResponse)request.GetResponse();

Here are the values of the request object:

AuthenticationLevel     MutualAuthRequested
CachePolicy                {Level:BypassCache}
ConnectionGroupName null
ContentLength             -1
ContentType                  "application/json"
Credentials                    null
Headers                         {Content-Type: application/json}
ImpersonationLevel       Delegation
Method                           "POST"
PreAuthenticate              false
Proxy                              {System.Net.WebRequest.WebProxyWrapper}
RequestUri                     {https://api.soundcloud.com/oauth2/token?client_id=############&client_secret=###########&grant_type=password&username=#######&password=########}
Timeout                          100000
UseDefaultCredentials   false

After the call I receive a 401 Unauthorized error, I even tried following Geek Life's blog but received the same error. Am I missing something here?

Upvotes: 0

Views: 1440

Answers (1)

Paul Osman
Paul Osman

Reputation: 4117

I think the problem here is that you are sending the client credentials in the query string of the request. You must send them in the request body instead.

Upvotes: 1

Related Questions