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

Expose response data in Authenticator.refresh(_:for:completion:) #3450

Open
1 task done
antiraum opened this issue May 7, 2021 · 1 comment
Open
1 task done

Expose response data in Authenticator.refresh(_:for:completion:) #3450

antiraum opened this issue May 7, 2021 · 1 comment

Comments

@antiraum
Copy link

antiraum commented May 7, 2021

Problem

Our API doesn't use an additional HTTP header to indicate authentication failure, but instead has error codes in the JSON response body. Therefore we must decode and evaluate the DataRequest.data in Authenticator.refresh(_:for:completion:).

Feature Request

The simplest solution would be to change

Authenticator.didRequest(_ urlRequest: URLRequest, with response: HTTPURLResponse, failDueToAuthenticationError error: Error) -> Bool

to

Authenticator.didRequest(_ request: Request, failDueToAuthenticationError error: Error) -> Bool

There is probably a better/non-breaking approach.

Value to Alamofire

Accommodate a broader variety of API authentication implementations.

@jshier
Copy link
Contributor

jshier commented May 10, 2021

Probably a good idea. We likely don't want to expose the Request directly, as there are types which won't have available Data, but some method of making it visible would be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants