Jabran Saeed
Jabran Saeed

Reputation: 6158

Stream from soundcloud API without user authentication

I am building an HTML5 soundcloud player that will stream tracks of a specific (artist)user ONLY. Soundcloud tells me to hardcode the user's credentials and use the Authentication without Connect Screen method.

In my case, I want to avoid that because the user created his SC account using Facebook and has no credentials. Since, I can get information about tracks, comments etc without authentication. My question.

Is it possible to stream a track with just clientid, no user authentication?

Currently, a get request to the stream_url yields a 401 Unauthorized Error.

$.get(stream_url+'&client_id='+clientid,function(e){
console.log(e)} 

401 Error Unauthorized

Thanks.

Upvotes: 0

Views: 1311

Answers (2)

JAL
JAL

Reputation: 42449

Playing tracks with the JavaScript API does not require authentication/login, just the Client ID of your API Application:

SC.initialize({
  client_id: '{CLIENT_ID}'
});

SC.stream('tracks/107686148').then(function(player) {
    player.play();
});

Upvotes: 1

Misha Reyzlin
Misha Reyzlin

Reputation: 13896

That depends on the properties of the particular track – if user has set their track to be private and/or non-embeddable etc. then it's not going to be possible.

However, if the track is public, you should be able to stream with just client_id.

I hope this helps.

Upvotes: 0

Related Questions