Skip to content

Commit 9b41e68

Browse files
author
George Villasboas
committed
Adding some documentation to the Custom Header Key
1 parent 1e0b4b8 commit 9b41e68

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Sources/OAuth2Client/NXOAuth2AccountStore.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ extern NSString * const kNXOAuth2AccountStoreConfigurationRedirectURL;
3535
extern NSString * const kNXOAuth2AccountStoreConfigurationScope;
3636
extern NSString * const kNXOAuth2AccountStoreConfigurationTokenType;
3737
extern NSString * const kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod;
38-
extern NSString * const kNXOAuth2AccountStoreConfigurationCustomHeaderFields;
3938

4039
/*
4140
* Requires a NSDictionary as a value.
@@ -45,6 +44,13 @@ extern NSString * const kNXOAuth2AccountStoreConfigurationCustomHeaderFields;
4544
*/
4645
extern NSString * const kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters;
4746

47+
/*
48+
* Requires a NSDictionary as a value.
49+
* They are passed onto the HTTP Header Fields request as additional parameters.
50+
* Example of a valid setup: @{ @"Content-type" : @"application/x-www-form-urlencoded" }
51+
*/
52+
extern NSString * const kNXOAuth2AccountStoreConfigurationCustomHeaderFields;
53+
4854

4955
#pragma mark Account Type
5056

Sources/OAuth2Client/NXOAuth2Client.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ - (void)authenticateWithUsername:(NSString *)username password:(NSString *)passw
407407
}
408408

409409
if (self.customHeaderFields) {
410-
[tokenRequest setAllHTTPHeaderFields:self.customHeaderFields];
410+
[self.customHeaderFields enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *obj, BOOL *stop) {
411+
[tokenRequest addValue:obj forHTTPHeaderField:key];
412+
}];
411413
}
412414

413415
authConnection = [[NXOAuth2Connection alloc] initWithRequest:tokenRequest

0 commit comments

Comments
 (0)