Automatic Soundcloud PHP Api authentication without user interaction

后端 未结 3 960
遇见更好的自我
遇见更好的自我 2020-12-19 11:49

In my application i want to use the Soundcloud API with my own Soundcloud user. The Soundcloud API authentication process involves a user being redirected to the Soundcloud

3条回答
  •  轮回少年
    2020-12-19 12:36

    I'm looking for the same thing, but according to the soundcloud's api (check the Authenticating without the SoundCloud Connect Screen paragraph):

    // this example is not supported by the PHP SDK
    

    ..and is not supported by the Javascript neither.

    I've tryed to auth with python:

    # create client object with app and user credentials
    client = soundcloud.Client(client_id='YOUR_CLIENT_ID',
                               client_secret='YOUR_CLIENT_SECRET',
                               username='YOUR_USERNAME',
                               password='YOUR_PASSWORD')
    

    ..then the uploading python method:

    # upload audio file
    track = client.post('/tracks', track={
        'title': 'This is my sound',
        'asset_data': open('file.mp3', 'rb')
    })
    

    and it works just fine.

    So, for now, you have 2 ways:

    1. Use another language, Python or Ruby (the only 2 sdk that actually support this feature) or use a small python/ruby script as a bridge for this particular need;
    2. Add this funcionaliy to the PHP SDK (i'm trying to do it quick'n'dirty, if i get success, i'll share ;)

提交回复
热议问题