Closed RobbeVW closed 8 years ago
Tell me the requests order/flow of your controller to replicate the error.
Login() -> PostLogin() -> Index()
?
show me the values of your:
SOUNDCLOUD_CALLBACK_URI
and SOUNDCLOUD_AUTO_CONNECT
add a try catch to the line that throws and var dump me the response object .
That flow is correct.
SOUNDCLOUD_CALLBACK_URL=http://localhost:8000/post-login SOUNDCLOUD_AUTO_CONNECT=false
The problem was that I kept getting 401 'unauthorized' errors. I played around with the code and got a working result (https://gist.github.com/glowdemon1/8caccb50599af41b2353b5eca3ac3452/revisions). Right now I need to re-login each time I refresh getIndex() strangely. If you happen to know the issue with that, please let me know. Thanks.
ok, nice you have a working code... but first:
$accessToken = Soundcloud::getAuthToken()
and store it on the user's session so you can add it for future request of your user while his session's active and valid on your website.On future requests from your user, you grab his/her token, and if valid, before any call to soundcloud you do Soundcloud::setAccessToken($accessToken)
and call the methods you want after.. everything should work as expected.
try it out and tell me how it went.
http://prntscr.com/bqubcx this is the value of my redirect url at the SC app configuration, it works fine somehow.
Thanks for the info. I got it to work fine now. Here's the working code, if anyone's interested. https://gist.github.com/glowdemon1/8caccb50599af41b2353b5eca3ac3452
that's the trick https://gist.github.com/glowdemon1/8caccb50599af41b2353b5eca3ac3452#file-pagescontroller-php-L15
Glad to help out.
I'm getting this error after I go to the getIndex() function. I believe I did everything right. Here's my code: https://gist.github.com/glowdemon1/8caccb50599af41b2353b5eca3ac3452 - did I do anything wrong or is this a bug?