Created
January 18, 2017 14:22
-
-
Save ryancarlson/fc4178ad75aadfbbfb428d770c3f80a0 to your computer and use it in GitHub Desktop.
The Key OAuth2 View Controller Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// FooC | |
// | |
// Created by Ryan Carlson on 1/11/17. | |
// Copyright © 2017 Cru. All rights reserved. | |
// | |
#import "ViewController.h" | |
#import <TheKeyOAuth2/TheKeyOAuth2Client.h> | |
#import <TheKeyOAuth2/TheKeyOAuth2LoginViewController.h> | |
@interface ViewController () <TheKeyOAuth2ClientLoginDelegate> | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
[[TheKeyOAuth2Client sharedOAuth2Client] setServerURL:[NSURL URLWithString:@"{url}"] | |
clientId:@"{id}"]; | |
} | |
- (IBAction)buttonWasPressed:(id)sender { | |
TheKeyOAuth2LoginViewController *loginVC = [[TheKeyOAuth2Client sharedOAuth2Client] loginViewControllerWithLoginDelegate:self]; | |
[self.navigationController pushViewController:loginVC animated:YES]; | |
} | |
-(void)loginViewController:(TheKeyOAuth2LoginViewController *)loginViewController loginSuccess:(NSString *)guid { | |
[[TheKeyOAuth2Client sharedOAuth2Client] ticketForServiceURL:[NSURL URLWithString:@{targetUrl}"] | |
complete:^(NSString *ticket) { | |
NSLog(@"%@", ticket); | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment