Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 416
RobSeg Avatar asked May 19 '13 11:05

RobSeg


2 Answers

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.

like image 164
nickf Avatar answered Oct 21 '22 11:10

nickf


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.

like image 1
cucko Avatar answered Oct 21 '22 11:10

cucko