Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scope support, Fix TokenRequest #300

Merged
merged 1 commit into from
May 30, 2024
Merged

Conversation

mohssenfathi
Copy link
Contributor

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.

@mohssenfathi mohssenfathi marked this pull request as ready for review May 24, 2024 23:20
@@ -15,19 +15,25 @@ public final class AuthorizationCodeAuthProvider: AuthProviding {
public let redirectURI: String

public typealias Completion = (Result<Client, UberAuthError>) -> Void

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: trailling whitespace

@mohssenfathi mohssenfathi merged commit 6a9616b into uber:2.x May 30, 2024
4 checks passed
@mohssenfathi mohssenfathi deleted the 2.x branch May 30, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants