Skip to content

Instantly share code, notes, and snippets.

@ryancarlson
Created January 18, 2017 14:22
Show Gist options
  • Save ryancarlson/fc4178ad75aadfbbfb428d770c3f80a0 to your computer and use it in GitHub Desktop.
Save ryancarlson/fc4178ad75aadfbbfb428d770c3f80a0 to your computer and use it in GitHub Desktop.
The Key OAuth2 View Controller Sample
//
// 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