Skip to content

A universal oauth login controller to be used with the OAuthConsumer library.

Notifications You must be signed in to change notification settings

achellies/BTOAuthLogin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a universal oauth login controller designed to be used with OAuthConsumer.
It takes a couple of settings for your specific OAuth setup and displays the login in a webview.

// Setup the login controller
BTOAuthLoginViewController *loginController = [[[BTOAuthLoginViewController alloc] init] autorelease];
loginController.delegate = self;
loginController.consumerKey = @"Your Consumer Key";
loginController.consumerSecret = @"Your Consumer Secret";;
    
// Twitter example
loginController.requestTokenEndpoint = @"https://api.twitter.com/oauth/request_token";
loginController.accessTokenEndpoint = @"https://api.twitter.com/oauth/access_token";
loginController.authorizationEndpoint = @"https://api.twitter.com/oauth/authorize";
loginController.consumerRealm = @"https://api.twitter.com";

// This can be anything.  It will not be called
loginController.authorizationCallbackUrl = @"http://sbtwitter.com";

// This flag is used to hide the cancel bar at the top of the view.  This defaults to NO.
loginController.hideCancelBar = NO;

[self presentModalViewController: loginController];



The login controller will send you the oauth token or alert you of an error using the following delegate methods.

/**
 *  Called when the OAuth login is successful.
 *
 *  @param  token   The OAuth token.
 *  @param  responseString  The response string from the oauth request. 
 */
- (void) BTOAuthLoginDidSucceedWithAccessToken: (OAToken *) token andResponseString: (NSString *) responseString;

/**
 *  Called when the OAuth login fails.
 *
 *  @param  error   The reason it failed.
 */
- (void) BTOAuthLoginDidFailWithError: (NSError *) error;

/**
 *  Called when the user cancels authentication.
 */
- (void) BTOAuthLoginCanceled;

This library uses the popular OAConsumer Library and the
ASIHTTPRequest Library to process the login. Thanks to those guys.

This is free to use however.

About

A universal oauth login controller to be used with the OAuthConsumer library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published