From 0f8d321740306c3d7e0399be068f26339ce75821 Mon Sep 17 00:00:00 2001 From: Boris Date: Thu, 9 Jul 2015 10:14:02 +0800 Subject: [PATCH 1/2] Create an API to set access token so no need to request for new one each time within 30 days --- UberKit/UberKit.h | 1 + UberKit/UberKit.m | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/UberKit/UberKit.h b/UberKit/UberKit.h index 6fc3d7d..805cee0 100644 --- a/UberKit/UberKit.h +++ b/UberKit/UberKit.h @@ -69,6 +69,7 @@ typedef void (^PromotionHandler) (UberPromotion *promotion, NSURLResponse *respo - (void) startLogin; - (NSString *) getStoredAuthToken; +- (void) setAuthTokenWith:(NSString *)token; #pragma mark - Product Types diff --git a/UberKit/UberKit.m b/UberKit/UberKit.m index 15254b8..214ec74 100644 --- a/UberKit/UberKit.m +++ b/UberKit/UberKit.m @@ -93,6 +93,11 @@ - (NSString *) getStoredAuthToken return _accessToken; } +- (void) setAuthTokenWith:(NSString *)token +{ + _accessToken = token; +} + #pragma mark - Product Types - (void) getProductsForLocation:(CLLocation *)location withCompletionHandler:(CompletionHandler)completion From 20e2c0563f90fc450eae44026df40281f0609e41 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 10 Jul 2015 15:28:08 +0800 Subject: [PATCH 2/2] added necessary scopes --- UberKit/UberKit.h | 1 - UberKit/UberKit.m | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/UberKit/UberKit.h b/UberKit/UberKit.h index 805cee0..6fc3d7d 100644 --- a/UberKit/UberKit.h +++ b/UberKit/UberKit.h @@ -69,7 +69,6 @@ typedef void (^PromotionHandler) (UberPromotion *promotion, NSURLResponse *respo - (void) startLogin; - (NSString *) getStoredAuthToken; -- (void) setAuthTokenWith:(NSString *)token; #pragma mark - Product Types diff --git a/UberKit/UberKit.m b/UberKit/UberKit.m index 214ec74..d9e1e97 100644 --- a/UberKit/UberKit.m +++ b/UberKit/UberKit.m @@ -93,11 +93,6 @@ - (NSString *) getStoredAuthToken return _accessToken; } -- (void) setAuthTokenWith:(NSString *)token -{ - _accessToken = token; -} - #pragma mark - Product Types - (void) getProductsForLocation:(CLLocation *)location withCompletionHandler:(CompletionHandler)completion @@ -334,13 +329,14 @@ - (void)setupOAuth2AccountStore { [[NXOAuth2AccountStore sharedStore] setClientID:_clientID secret:_clientSecret + scope:[NSSet setWithObjects:@"request", @"history_lite", @"profile", nil] authorizationURL:[NSURL URLWithString:@"https://login.uber.com/oauth/authorize"] tokenURL:[NSURL URLWithString:@"https://login.uber.com/oauth/token"] redirectURL:[NSURL URLWithString:_redirectURL] + keyChainGroup:nil forAccountType:_applicationName]; - [[NSNotificationCenter defaultCenter] addObserverForName:NXOAuth2AccountStoreAccountsDidChangeNotification object:[NXOAuth2AccountStore sharedStore] queue:nil