Advertisement
Guest User

Untitled

a guest
Oct 30th, 2011
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma - OpenAuth
  2. - (GTMOAuthAuthentication *)myCustomAuth {
  3.     GTMOAuthAuthentication *auth;
  4.     auth = [[[GTMOAuthAuthentication alloc] initWithSignatureMethod:kGTMOAuthSignatureMethodHMAC_SHA1
  5.                                                         consumerKey:myConsumerKey
  6.                                                          privateKey:myConsumerSecret] autorelease];
  7.     // setting the service name lets us inspect the auth object later to know
  8.     // what service it is for
  9.     auth.serviceProvider = @"Custom Auth Service";
  10.     return auth;
  11. }
  12. - (void)signInToCustomService {
  13. #if 1
  14.     NSURL *requestURL = [NSURL URLWithString:@"https://api.login.yahoo.com/oauth/v2/get_request_token"];
  15.     NSURL *accessURL = [NSURL URLWithString:@"https://api.login.yahoo.com/oauth/v2/get_token"];
  16.     NSURL *authorizeURL = [NSURL URLWithString:@"https://api.login.yahoo.com/oauth/v2/request_auth"];
  17.     //NSString *scope = @"https://api.login.yahoo.com";
  18.     NSString* scope = nil;
  19.     GTMOAuthAuthentication *auth = [self myCustomAuth];
  20.     [auth setCallback:@"http://www.yahoo.com"];
  21.     [auth setDisplayName:nil];
  22. #endif
  23.     // Display the autentication view
  24.     GTMOAuthViewControllerTouch *viewController;
  25.     viewController = [[[GTMOAuthViewControllerTouch alloc] initWithScope:scope
  26.                                                                 language:nil
  27.                                                          requestTokenURL:requestURL
  28.                                                        authorizeTokenURL:authorizeURL
  29.                                                           accessTokenURL:accessURL
  30.                                                           authentication:auth
  31.                                                           appServiceName:@"FantasyStats"
  32.                                                                 delegate:self
  33.                                                         finishedSelector:@selector(viewController:finishedWithAuth:error:)] autorelease];
  34.     [[self navigationController] pushViewController:viewController
  35.                                            animated:YES];
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement