how to authenticate Soundcloud API with redirect_uri (callback.html)

…衆ロ難τιáo~ 提交于 2019-12-23 09:08:08

问题


The final goal is to let users be able to upload / download files through the soundcloud API.

I have registered my app, but now I have got problems with the authentication. In the app registration i must define a redirect URI for authentication, their default is callback.html. What to put there myself?

I dont know what to put there, in redirect uri of the app or in the code (assuming it must be the same) I've tried making a callback.html myself, but it doesnt work. I'm starting to think it must be an online link. But i'm only working on localhost..

I've found a very similar question here: redirect_uri and how to host callback.html on SoundCloud?

but it doesnt solve my problem.

I realize this is very basic stuff, but i hope i can get some clear help. thank you very much

EDIT : for testing, i've put http://www.samplewars.com/ in the app registration redirect_uri and in the redirect_uri in my code, and now i get the pop-up asking for acces to the soundcloud account, after clicking connect it goes to samplewars.com. How do i make it go to the same page, (localhost url). Is actually possible to put an offline link there, as i'm only working on localhost? i dont have anything online.


回答1:


The callback file is used to send the authentication token back to your application. In your case it should be something like http://www.samplewars.com/soundcloud-callback.html. For development, you could register a different application which points to your local setup (eg http://localhost/soundcloud-callback.html or whatever).

If you use the SoundCloud Javascript API, this is fairly simple. There's an example page in the documentation.




回答2:


in your windows/system32/drivers/etc/hosts file

add line127.0.0.1 localhost.samplewars.com and you can use that domain for testing purposes.



来源:https://stackoverflow.com/questions/16634134/how-to-authenticate-soundcloud-api-with-redirect-uri-callback-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!