Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

It's not possible to retrieve secondary data from the authentication request #84

Open
blixt opened this issue Dec 23, 2014 · 5 comments

Comments

@blixt
Copy link

blixt commented Dec 23, 2014

It's not uncommon to include additional data in a successful OAuth response. How come only the token is accessible in the success handler?

I realize this won't be easy to change for backwards compatibility reasons, but if a major version is coming up, it would be nice to have the block signatures (mostly) match all the standard AFNetworking ones by simply adding the AFHTTPRequestOperation *operation parameter in front. While the second argument to success would still be AFOAuthCredential, the developer can choose to extract extra parameters from the AFHTTPRequestOperation instance's responseObject property.

In the meantime, perhaps something could be done to support accessing the additional parameters?

@blixt
Copy link
Author

blixt commented Dec 23, 2014

For some examples of OAuth endpoints that return extra data you can find some here:

@itsthejb
Copy link

Indeed, same issue here - most OAuth APIs I've worked with return the authenticated user in the auth request success response.

loudnate pushed a commit to chairish/AFOAuth2Manager that referenced this issue Feb 9, 2015
Adds AFHTTPRequestOperation arguments to the success and failure block signatures, as discussed in issue AFNetworking#84
loudnate pushed a commit to chairish/AFOAuth2Manager that referenced this issue Feb 9, 2015
Adds AFHTTPRequestOperation arguments to the success and failure block signatures, as discussed in issue AFNetworking#84
loudnate pushed a commit to chairish/AFOAuth2Manager that referenced this issue Mar 11, 2015
Adds AFHTTPRequestOperation arguments to the success and failure block signatures, as discussed in issue AFNetworking#84
@OmarPedraza
Copy link

+1

The OAuth2 server I'm working with returns a bad request status when user or password are invalid and includes a description error in the responseObject, so I need to access to the responseObject to give the user more information about the error.

yreifschneider pushed a commit to FINARX/AFOAuth2Manager that referenced this issue Dec 17, 2015
success block and only the data task as a callback argument for the
failure block. Fixes the problem described in issue AFNetworking#84.
@jroa919
Copy link

jroa919 commented Jan 27, 2016

+1

Our OAuth2 server also returns HTTP/1.1 400 Bad request for an invalid username/password combination. AFNetworking returns this as an error and this is obscured when the failure(...) block omits the data task argument.

On the topic of extendability, we are using an OpenID Connect server that returns additional information in the authentication request responseObject (such as 'id_token', etc.). This information is also lost in the success(...) block.

Looking at #112, those changes achieve exactly what I'm looking for. Hoping to see this merged into the 3_0_0_branch.

@boojapathyc
Copy link

any updates on this issue.

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

No branches or pull requests

5 participants