Depending on the supplied configuration, the implementer may want auth to occur from inside the Uber app, as opposed to internal to the SDK in an embedded web browser.
Pulling from the code comments:
There are three possible destinations for auth through this method:
1. The native Uber app
2. The OS supplied Safari browser
3. In app auth through ASWebAuthenticationSession
This method will run through the desired native app destinations supplied in `appPriority`.
For each one it will:
* Use the configuration provider to determine if the app is installed, using UIApplication's openUrl. If the app's scheme has not been registered in the Info.plist and is not queryable it will default to true and continue with the auth flow. If it is registered but not installed, we will continue to the next app.
* Build a universal link specific to the current app destination
* Attempt to launch the app using the `applicationLauncher`. If the app is installed, the native app should be launched (1), if not the OS supplied browser will be launched (2)
If all app destinations have been exhausted and no url has been launched we fall back to in app auth (3)
Redirect URI handling
After authenticating in the native app, the success/failure response will be sent back to the calling app via deeplink. This then needs to be forwarded to the lib via the UberAuth.handle() method.
Logic is fairly simple here, we parse the response url using AuthorizationCodeResponseParser and call the store completion with the result.
Testing
Manually
Prerequisite: Have at least one of Uber, UberEats, or UberDriver installed
Update the Client ID in the sample app's Info.plist to 9QZcD_Ki6NbhGCrVXSUHCxfevm-C9Khj
Build/run the sample app
Select Native from the Destination selector
Tap Login
App should deep link to the 1P uber client then return to the sample app with the authorization code
Description
This PR implements two major features:
Native authentication
Depending on the supplied configuration, the implementer may want auth to occur from inside the Uber app, as opposed to internal to the SDK in an embedded web browser.
Pulling from the code comments:
Redirect URI handling
After authenticating in the native app, the success/failure response will be sent back to the calling app via deeplink. This then needs to be forwarded to the lib via the
UberAuth.handle()
method. Logic is fairly simple here, we parse the response url usingAuthorizationCodeResponseParser
and call the store completion with the result.Testing
Manually
Prerequisite: Have at least one of Uber, UberEats, or UberDriver installed
9QZcD_Ki6NbhGCrVXSUHCxfevm-C9Khj
Unit tests
Unit tests added for all logic heavy classes
Video
https://github.com/uber/rides-ios-sdk/assets/5241321/1ad8642b-7fb6-45d7-9180-34716ee22e43