google / gtm-oauth2

Google Toolbox for Mac - OAuth 2 Controllers
Apache License 2.0
125 stars 70 forks source link

GTMOAuth2ViewControllerTouch OAuth problem #85

Closed skywalkerlw closed 7 years ago

skywalkerlw commented 7 years ago

According to Google's blog on 22/08/2016 at https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html, embedded user-agent (also know as a webview) is not allowed to make an OAuth authorisation any more. That's the reason why I got an error when I tried on this demo project(https://developers.google.com/drive/ios/quickstart) to present a GTMOAuth2ViewControllerTouch view controller:

GTMOAuth2ViewControllerTouch *authController;
NSArray *scopes = [NSArray arrayWithObjects:kGTLAuthScopeDriveMetadataReadonly, nil];
authController = [[GTMOAuth2ViewControllerTouch alloc]
                      initWithScope:[scopes componentsJoinedByString:@" "]
                      clientID:kClientID
                      clientSecret:nil
                      keychainItemName:kKeychainItemName
                      delegate:self
                      finishedSelector:@selector(viewController:finishedWithAuth:error:)];

My question is: it seems that GTMOAuth2ViewControllerTouch is not allowed be used any more, what's the alternative way?

image

thomasvl commented 7 years ago

Yup, looks like server side decided to start closing things off. We're going ahead and deprecating this as there are other alternatives that include support for more things (including tvOS). We'll be updating the projects that used this in the sample code also.