Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the redirectURL I should put in my Uber app?

Tags:

uber-api

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!

like image 736
Boris Avatar asked Jun 29 '15 09:06

Boris


1 Answers

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.

like image 171
Boris Avatar answered Oct 11 '22 01:10

Boris