Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds support for exchanging the authorization code returned from the /authorize endpoint for a token using the /token endpoint
Completion Handling
I "intercepted" the completion handler passed into the execute method and exchange the token there if needed. I manually verified using the memory debugger that instances were not retained, but please double check me.
Request -> NetworkRequest
There was a naming conflict between UberAuth.Request and UberRides.Request, and I couldn't specify the namespace because I named a class (UberAuth) the same as the framework name 😅. So this was breaking mocks.
I renamed Request to NetworkRequest to fix this. If UberRides is removed in the future we could change the name back.
TokenRequest
This should be similar to the other requests, ParRequest or AuthorizeRequest. It makes a request to the token endpoint and decodes a Token response conforming to the OAuth standard.
Testing
Unit Tests
Unit tests added for new auth provider logic.
Manual Testing
9QZcD_Ki6NbhGCrVXSUHCxfevm-C9Khj
in the sample app's Info.plistExchange Auth Code for Token
to onVideo