nxtbgthng / OAuth2Client

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

Custom headers are not added to requests #169

Open blastar opened 9 years ago

blastar commented 9 years ago

Maybe someone can point me in right direction, but so far it seems that custom headers are applied only to authorization related request. I have kNXOAuth2AccountStoreConfigurationCustomHeaderFields added in my account config, but then doing NXOAuth2Request performMethod: onResource: method - (void)performRequestWithSendingProgressHandler:(NXOAuth2ConnectionSendingProgressHandler)progressHandler responseHandler:(NXOAuth2ConnectionResponseHandler)responseHandler is called in which there is no custom headers handling at all. When added simple: [request setValue:@"yyyy" forHTTPHeaderField:@"xxxxx"]; everything started to work. Is this feature planned? Or kNXOAuth2AccountStoreConfigurationCustomHeaderFields is just useless?

toto commented 9 years ago

The simplest way to use custom headers with non-auth requests is to use the -[NXOAuth2Request signedRequest], make a mutable copy and configure your headers. With OAuth2 this should not affect your request from working as long as you do not touch the Authorization: header. See here for details