nxtbgthng / OAuth2Client

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

Check for nil values when calling [[NXOAuth2AccountStore sharedStore] setClient: . . . keyChainGroup: #156

Closed tomhoag closed 9 years ago

tomhoag commented 9 years ago

When calling [[NXOAuth2AccountStore sharedStore] setClient: . . . keyChainGroup: it is important that keyChainGroup be passed a non-null NSString. Pass nil will cause havoc when the method parameters are put into the parameter dictionary:

[self setConfiguration:[NSDictionary dictionaryWithObjectsAndKeys:
                                aClientID, kNXOAuth2AccountStoreConfigurationClientID,
                                aSecret, kNXOAuth2AccountStoreConfigurationSecret,
                                theScope, kNXOAuth2AccountStoreConfigurationScope,
                                anAuthorizationURL, kNXOAuth2AccountStoreConfigurationAuthorizeURL,
                                aTokenURL, kNXOAuth2AccountStoreConfigurationTokenURL,
                                aKeyChainGroup, kNXOAuth2AccountStoreConfigurationKeyChainGroup,
                                aRedirectURL, kNXOAuth2AccountStoreConfigurationRedirectURL,
                                nil];
            forAccountType:anAccountType];

Passing keyChainGroup a nil value effectively removes the redirectURL from the dictionary.

Fix: Implementor: Pass an empty string (@"") for the keyChainGroup instead of nil || Source: add an assert that checks for non-nil keyChainGroup value in the [[NXOAuth2AccountStore sharedStore] setClient: . . . keyChainGroup: method

tomhoag commented 9 years ago

Added fix and created pull request.

tomhoag commented 9 years ago

Fix accepted. Closing.