问题
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!
回答1:
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.
回答2:
The API interaction initiates as follows:
- The concerned request is redirected to Uber API,
- API authorizes the action
- API redirects user to a Custom page of your website, with a GET parameter that will contain all needed information sent by API.
So, basically, redurect URL is the page of your website that does the job once the user is authenticated via Uber API.
See more at official doc
回答3:
Redirect url is actually an url of opening your app. The official documentation has good insight in this regard.Read it here.
来源:https://stackoverflow.com/questions/31111813/what-is-the-redirecturl-i-should-put-in-my-uber-app