nxtbgthng / OAuth2Client

Client library for OAuth2 (currently built against draft 10 of the OAuth2 spec)
855 stars 217 forks source link

Adding custom header in order to provide a POST with custom MIME types #124

Closed ghost closed 10 years ago

ghost commented 10 years ago

Our server desires a oAuth-request with a POST MIME type of 'application/x-www-form-urlencoded'. In order to get it work with the OAuth2Client we needed to add the support of creating the desired POST request.

The OAuth2Client in this state will only work with application/x-www-form-urlencoded and the 'multipart/form-data'. More MIME types must be added if needed. But IMO this is a good start to do so.

If the (new) kNXOAuth2AccountStoreConfigurationCustomHeaderFields key is set in the NXOAuth2AccountStore configuration the all header fields of the resulting HTTP-Request are replaced with the value for this key.

ghvillasboas commented 10 years ago

Hi Andreas! The funny thing is that I was just working on a similar PR for this feature. Also for an app that interacts with Meetup.com. You were faster. :)

My only suggestion is to add your new key (kNXOAuth2AccountStoreConfigurationCustomHeaderFields) to the NXOAuth2AccountStore h/m files. So it's easier to define it when configuring the shared store.

And authors, please accept this PR!

Best. George.

ghost commented 10 years ago

Hi George,

thanks for pointing that out. I just missed to commit the constants... ups ;-)

Best Andreas

ghvillasboas commented 10 years ago

@AndreasTextunes there are some problems with your code. Specially with the external browser flow. Do you mind if I send a new PR mixing your code and mine?

ghost commented 10 years ago

@ghvillasboas If it works for both of us sure.

toto commented 10 years ago

This looks very useful indeed, I added a few very tiny tiny complaints.

If you fix those I will merge this in and it will be in the next minor release.

ghost commented 10 years ago

Yeah, cool :-) I'll change that complaints you have.

BTW: I didn't changed the NSAsserts... But I'll fix it anyway.

toto commented 10 years ago

:+1: