2016-01-18 53 views
0

我試圖通過使用它們的API來登錄soundcloud。我設法從/connect獲得了成功響應的代碼,但是當我嘗試獲得token時,最終出現401錯誤。以下是我發送的內容:在soundcloud api上使用oauth2進行身份驗證

POST /oauth2/token HTTP/1.1 
Host: api.soundcloud.com 
Content-Type: application/x-form-urlencoded 
Cache-Control: no-cache 
Postman-Token: 255c7769-0f65-5c40-27bc-9429ea8c38ea 

client_id=<my client id>& 
client_secret=<my secret id>& 
redirect_uri=http%3A%2F%2Fmywebsite& 
grant_type=authorization_code& 
code=a99cfc85c0e46235d7fdb9ca74b7dddd%23 

有沒有人知道我在這裏錯過什麼來獲得工作要求?

回答

1

原來,我不是叫/連接正確,這是正確的做法:

https://soundcloud.com/connect? 
client_id=<my client id> 
&redirect_uri=<my redirect url> 
&response_type=token 
&scope=non-expiring 
&display=popup 

隨着response_type=token,我們直接獲得訪問令牌,所以我們並不需要調用/oauth2/token然後。

相關問題