I'm reading Uber's sdk/api doc but I am a rookie and I don't know what the redirectURL should be. Is it a given url from Uber? Because I couldn't find it. Or is it an url for a webpage customized by app developer deployed their own server/local machine? If so, how should I write it?
Totally confused on this point.
Please help with some details as possible.
Many thanks!
Here I solved this problem. Actually I was confused that if the redirect url is a url for web site on some server, then the architect would be quite complex and there seems to be no way to identify which authorization code is for which app client.
Now I think I'm clear since I read @Romain's comment here, and now I know that the redirect url can be an url of opening your ios app (I'm sure it works for android and others).
For instance, if your ios app's URL schema/name is: myapp, then the redirect url can be like this:
myapp://oauth/callback
then once user authorizes your app, the redirect url (in this case it's redirecting to your app) will be opened; and in the AppDelegate.m one of the callback delegate methods:
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
will capture the redirect url with the authorization code sent from Uber; if you print it you would see something like this:
myapp://oauth/callback?code=YOURCODE
So the code can be well received by the correct app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With