Automatic Soundcloud PHP Api authentication without user interaction

后端 未结 3 961
遇见更好的自我
遇见更好的自我 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:48

    There is no magic behind its implementation in Python and Ruby SDK's. What's happening is that POST request is sent to http://api.soundcloud.com/oauth2/token with the following params:

       client_id='YOUR_CLIENT_ID'
       client_secret='YOUR_CLIENT_SECRET'
       username='YOUR_USERNAME'
       password='YOUR_PASSWORD'
    

    And Content-Type: application/x-www-form-urlencoded

    The response body contains access_token, that can be used for the further authorization of your requests. Thus, your GET request to /me endpoint will look like: /me?oauth_token=YOUR_ACCESS_TOKEN&client_id=YOUR_CLIENT_ID. (I believe, client_id is redundant here but all their apps keep adding it).

    Here is the Postman Doc I created for demonstration: https://documenter.getpostman.com/view/3651572/soundcloud/7TT5oD9

提交回复
热议问题