uber / rides-ios-sdk

Uber Rides iOS SDK (beta)
https://developer.uber.com/docs
MIT License
371 stars 123 forks source link

Add scope support, Fix TokenRequest #300

Closed mohssenfathi closed 2 months ago

mohssenfathi commented 3 months ago

Description

Combining a few minor fixes for bugs found in UberAuth. Details below.

Changes

Scopes

Scopes were not being sent in the Authorize request, only the default scope was being used in all cases. This PR adds logic to inject the scopes passed in the AuthContext into the authorize request and on to the backend.

Application Launcher

There were certain scenarios where the ApplicationLauncher, a protocol representing UIApplication's openURL, could be called from a background thread. This wraps the only openURL call to ensure it is made from the main thread. To support this change in testing, a closure can now be passed in to AuthorizationCodeAuthProvider allowing us to specify the AuthorizationSession to be used when launching in app auth.

TokenRequest body

We were incorrectly setting the form url encoded body for the TokenRequest as the url parameters, and it was somehow still working. This PR fixes this by setting the values in the httpBody instead.