On Sun, Oct 23, 2011 at 11:14 AM, Jeena <jeenap...@gmail.com> wrote:
> Hi,
>
> I am trying to write a OS X client for SoundCloud but I struggle with
> two things:
>
>
> 1. When I try to use OAuth with:
>
> [SCSoundCloudAPIConfiguration
> configurationForSandboxWithClientID:CLIENT_KEY
> clientSecret:CLIENT_SECRET redirectURL:[NSURL
> URLWithString:@"mypp:"]];
>
> Then it opens the browser and I get a blank page with just:
> "invalid_request: Invalid parameter: redirect_uri"
>
> I did set "myapp:" as the "Redirect URI" on the http://soundcloud.com/you/apps/myapp/edit
> site, I even tried with "myapp://" but no luck.
Looking at the database entry, I see that the Redirect URI is set to
empty string. I also recommend to have a URI complete with a path as
well, i.e. "scheme://path". This will work with all user agents that
work with URLs.
Cheers,
Hannes
Thanks for your fast reply.
> Looking at the database entry, I see that the Redirect URI is set to
> empty string.
Hm that is odd because when I go to http://soundcloud.com/you/apps/myapp/edit I can see the string "myapp:" in the "Redirect URI" field.
> I also recommend to have a URI complete with a path as
> well, i.e. "scheme://path". This will work with all user agents that
> work with URLs.
Ok, I changed it to "myapp://login_done" but still the same problem.
/Jeena
I'm really sorry but I cannot find an application with this Redirect
URI in any of our databases. Are you sure that your changes were
saved?
Cheers,
Hannes
>
> /Jeena
>
> --
> You received this message because you are subscribed to the Google Groups "SoundCloudAPI" group.
> To post to this group, send email to soundc...@googlegroups.com.
> To unsubscribe from this group, send email to soundcloudap...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/soundcloudapi?hl=en.
>
>
--
Hannes Tydén
Developer, SoundCloud
Mail: han...@soundcloud.com
Skype: hannestyden
Phone: +49 157 7471 6101
Rosenthalerstr. 13
10119 Berlin, DE
What is SoundCloud?
http://soundcloud.com/tour
Limited registered at Company House, Cardiff, UK. Registered Office:
London, UK. Company Number 6343600
Managing Directors: Alexander Ljung, Eric Wahlforss
Local Branch Office Berlin, Germany: AG Charlottenburg, HRB 110657B
> I'm really sorry but I cannot find an application with this Redirect
> URI in any of our databases. Are you sure that your changes were
> saved?
Hm yes, I'm pretty sure the changes were saved because when I open the page and have a look at the form right now (without changing anything) I see "myapp://login_done" as my Redirect URI.
I just send you a private email with the real name of the app and a screenshot.
/Jeena
> The Redirect URI check is an exact, case sensitive comparison against
> the registered value, so what you see in the settings form for the app
> is what should be sent.
I copy & pasted them. The only thing I could think of is that they somewhat get changed via [NSURL URLWithString:] through some escaping or something? But the wrapper expects a NSURL.
>> 2. It does work when I use the [scAPI
>> authenticateWithUsername:@"m...@example.com" password:@"password"]
>> method, the [scAPIDelegate soundCloudAPIDidAuthenticate] method is
>> called and scAPI.authenticated returns true, but when I run [scAPI
>> performMethod:@"GET" onResource:@"tracks" withParameters:nil
>> context:nil userInfo:nil] the didFinishWithData delegate method never
>> gets called.
>>
>> The funny thing is, sometimes it works just fine and a couple of hours
>> later without changing the code I try to run it and nothing happens, I
>> wait again a couple of hours and it works again, I'm really confused.
>
> Are the user credentials hard coded in the app?
Yes.
/Jeena
> I think the best approach to solve this is to inspect the actual
> requests and responses using Charles [0],
Hm yeah, I was trying to do that but because it was https I was only seeing jibberish in Charles.
> if your using an iOS device
> they've instructions for getting that working [1].
No it is a normal OS X application, but on that FAQ they state that you can decrypt the SSL stuff, I will have a deeper look into that, thanks so far!
/Jeena
Ok, I was able to use Charles now to have a look at the ssl encrypted data and I can not see what could cause the error, I am sending this get request
GET /connect?client_id=CLIENT_KEY&response_type=code&redirect_uri=myapp%3A%2F%2Flogin_done HTTP/1.1
(CLIENT_KEY is my real client key, not the string "CLIENT_KEY" and myapp is my real app's name not the string "myapp")
As far as I can see it is escaped in the right way. But I still just get a HTTP/1.1 400 Bad Request, invalid_request: Invalid parameter: redirect_uri.
/Jeena
I'm sorry for missing this requirement, but the Redirect URI needs to
be a proper URI.
This means that the part following "://" must contain a hostname,
which, by definition, cannot contain an underscore.
So changing the Redirect URI to "myapp://logindone" will work.
Sorry for the confusion, we will fix the input validation for the app
edit form to catch this error.
Thanks for your patience,
Hannes
> I'm sorry for missing this requirement, but the Redirect URI needs to
> be a proper URI.
>
> This means that the part following "://" must contain a hostname,
> which, by definition, cannot contain an underscore.
>
> So changing the Redirect URI to "myapp://logindone" will work.
Oh yeah! Now it works, thank you very much for your patience :-)
/Jeena