Skip to content

Commit

Permalink
Merge pull request #151 from box/tokengrantparam
Browse files Browse the repository at this point in the history
Fixing naming of additional token grant parameters & exposing it only
  • Loading branch information
sowmiya committed Dec 18, 2015
2 parents c06bd53 + 3caa41a commit 30e3643
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
*/
@interface BOXAuthorizationViewController : UIViewController <UIWebViewDelegate>

/**
* Custom parameters to use in the token grant request. Optional, defaults to nil.
*/
@property (nonatomic, readwrite, strong) NSDictionary *additionalTokenGrantParams;

/** @name Initializers */

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ - (NSString *)redirectURI
return _redirectURI;
}

- (void)setAdditionalTokenGrantParams:(NSDictionary *)additionalTokenGrantParams
{
BOXOAuth2Session *OAuth2Session = (BOXOAuth2Session *)self.SDKClient.session;
OAuth2Session.additionalTokenGrantParams = additionalTokenGrantParams;
}

#pragma mark - Actions

- (void)cancel:(id)sender
Expand Down
10 changes: 5 additions & 5 deletions BoxContentSDK/BoxContentSDK/OAuth2/BOXOAuth2Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@
*/
@property (nonatomic, readwrite, strong) NSString *APIAuthBaseURLString;

/**
* Custom parameters to use in the token grant request. Optional, defaults to nil.
*/
@property (nonatomic, readwrite, strong) NSDictionary *additionalTokenGrantParams;

/**
* Exchange an authorization code for an access token and a refresh token.
*
Expand Down Expand Up @@ -172,6 +167,11 @@
*/
@property (nonatomic, readwrite, strong) NSString *redirectURIString;

/**
* Custom parameters to use in the token grant request. Optional, defaults to nil.
*/
@property (nonatomic, readwrite, strong) NSDictionary *additionalTokenGrantParameters;

/**
* Returns the randomly generated nonce used to prevent spoofing attack during login
* @return generated nonce
Expand Down
4 changes: 2 additions & 2 deletions BoxContentSDK/BoxContentSDK/OAuth2/BOXOAuth2Session.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ - (void)performAuthorizationCodeGrantWithReceivedURL:(NSURL *)URL withCompletion
BOXAuthTokenRequestClientSecretKey : self.clientSecret,
BOXAuthTokenRequestRedirectURIKey : self.redirectURIString,
}];
if (self.additionalTokenGrantParams.count > 0) {
[POSTParams addEntriesFromDictionary:self.additionalTokenGrantParams];
if (self.additionalTokenGrantParameters.count > 0) {
[POSTParams addEntriesFromDictionary:self.additionalTokenGrantParameters];
}

BOXAPIOAuth2ToJSONOperation *operation = [[BOXAPIOAuth2ToJSONOperation alloc] initWithURL:[self grantTokensURL]
Expand Down

0 comments on commit 30e3643

Please sign in to comment.