Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Soundcloud API authentication without a web browser

I am working on a Soundcloud XBMC add-on. The add-on is open source, and written in Python. I would like to allow users to login to their SoundCloud account via the add-on, however it's possible to have XBMC instances running in an environment without access to a typical web browser (e.g. raspbmc, which provides no window manager or graphical browser by default). Is there a way to still allow users to authenticate with this add-on without requiring use of the 'SoundCloud Connect Screen' and without violating the SoundCloud API TOS?

like image 406
Arthur Richards Avatar asked Jan 22 '13 00:01

Arthur Richards


People also ask

How do I access SoundCloud API?

To access the SoundCloud® API, you will first need to register your app at https://soundcloud.com/you/apps using your SoundCloud® account. When you've done that, we'll issue you with a client ID and client secret. Your client ID is required for all calls to the SoundCloud® API.

How do I authorize my SoundCloud?

If the user is already signed into SoundCloud, they will be able to authorize your request in one click. Users of your app will be redirected to the SoundCloud Connect screen. If the user approves your authorization request, they will be sent to the redirect_uri you specified when registering your app.

How do I get oauth tokens on SoundCloud?

You don't generate it on yourself, you get it from the SoundCloud API. You have first to authorize with your client_id, client_secret and a redirect_url then in the redirect_url (which the soundcloud server will call it should be some script on your server) you can get the token from the GET parameter "code".

How do I use SoundCloud API on Android?

You need to get your client_id and client_secret by registering your app here. After you have obtained that, you can start using the API. Basically, most of the calls will look like this one: final SoundCloud api = new SoundCloud.


1 Answers

This is not provided in theirs API, but after some digging into the libraries i figured it out. Make a POST to: https://api.soundcloud.com/oauth2/token

with these params

grant_type=password&client_id=YOUR_CLIENT_ID&client_secret=YOUR_SECRET_ID&username=USERNAME&password=PASSWORD&scope=non-expiring

this will return non expiring token that you can use for future authenticated requests.

like image 162
cucko Avatar answered Oct 23 '22 20:10

cucko