Comments (6)
Here's my code btw. I haven't modified the gtm-oauth classes at all.
- (void)connectToSavedAccountSession
{
// Connect to saved account if available
GTMOAuth2Authentication *auth = [GTMOAuth2WindowController authForGoogleFromKeychainForName:[NSString stringWithFormat:@"%@ - Google Reader",self.clientName]
clientID:self.clientID
clientSecret:self.clientSecret];
[mAuth autorelease];
mAuth = [auth retain];
}
- (void)signInWithDelegate:(id)delegate parentWindow:(NSWindow*)window
{
[self signOut];
// For Google APIs, the scope strings are available
// in the service constant header files.
NSString *scope = @"https://www.googleapis.com/auth/plus.me";
// Display the autentication sheet
GTMOAuth2WindowController *windowController;
windowController = [GTMOAuth2WindowController controllerWithScope:scope
clientID:self.clientID
clientSecret:self.clientSecret
keychainItemName:[NSString stringWithFormat:@"%@ - Google Reader",self.clientName]
resourceBundle:nil];
// During display of the sign-in window, loss and regain of network
// connectivity will be reported with the notifications
// kGTMOAuth2NetworkLost/kGTMOAuth2NetworkFound
//
// See the method signInNetworkLost: for an example of handling
// the notification.
// Optional: Google servers allow specification of the sign-in display
// language as an additional "hl" parameter to the authorization URL,
// using BCP 47 language codes.
//
// For this sample, we'll force English as the display language.
NSDictionary *params = [NSDictionary dictionaryWithObject:@"en"
forKey:@"hl"];
windowController.signIn.additionalAuthorizationParameters = params;
// Optional: display some html briefly before the sign-in page loads
NSString *html = @"<html><body><div align=center>Loading sign-in page...</div></body></html>";
windowController.initialHTMLString = html;
// Most applications will not want the dialog to remember the signed-in user
// across multiple sign-ins, but the sample app allows it.
// windowController.shouldPersistUser = [mPersistUserCheckbox state];
// By default, the controller will fetch the user's email, but not the rest of
// the user's profile. The full profile can be requested from Google's server
// by setting this property before sign-in:
//
// windowController.signIn.shouldFetchGoogleUserProfile = YES;
//
// The profile will be available after sign-in as
//
// NSDictionary *profile = windowController.signIn.userProfile;
[windowController signInSheetModalForWindow:window
delegate:self
finishedSelector:@selector(windowController:finishedWithAuth:error:)];
}
- (void)signOut
{
if ([mAuth.serviceProvider isEqual:kGTMOAuth2ServiceProviderGoogle]) {
// Remove the token from Google's servers
[GTMOAuth2WindowController revokeTokenForGoogleAuthentication:mAuth];
}
// Remove the stored Google authentication from the keychain, if any
[GTMOAuth2WindowController removeAuthFromKeychainForName:[NSString stringWithFormat:@"%@ - Google Reader",self.clientName]];
// Discard our retained authentication object
[mAuth release];
mAuth = nil;
}
- (BOOL)isAuthorized
{
return mAuth.canAuthorize;
}
- (void)windowController:(NSWindowController*)windowController
finishedWithAuth:(GTMOAuth2Authentication*)theAuth error:(NSError*)error
{
if (error) NSLog(@"Error: %@",[error localizedDescription]);
[mAuth release];
mAuth = [theAuth retain];
}
Original comment by [email protected]
on 31 Dec 2011 at 10:44
from gtm-oauth2.
[deleted comment]
from gtm-oauth2.
[deleted comment]
from gtm-oauth2.
[deleted comment]
from gtm-oauth2.
This sounds like an issue with the Reader API, not with the gtm-oauth2
controllers.
Original comment by [email protected]
on 4 Jan 2012 at 1:59
from gtm-oauth2.
Closing as done since this seems to be pretty old without any new info.
Original comment by [email protected]
on 30 Oct 2014 at 1:49
- Changed state: Done
from gtm-oauth2.
Related Issues (20)
- Plus.me scope is deprecated
- This is the last few lines of code on a different thread that I can see while I debug the issue. I've spent quite some time on debugging this now with no success and eventually decided to file this issue.
- GTMOAuth2Authentication.h file not found HOT 3
- "Don't ask for code again" for two factor auth is not working HOT 4
- Buttons in oauth2 controller not active
- canAuthorize returns false in simulator but true on real device (iOS 10) HOT 3
- default scopes added automatically? HOT 1
- Google calendar issues HOT 1
- Loss of authorisation on the simulator iPhone SE HOT 2
- Is this deprecated now? HOT 2
- GTMOAuth2ViewControllerTouch OAuth problem HOT 1
- 403. That's an error HOT 5
- Pod 1.1.4 - "GTMOAuth2ErrorTokenUnavailable" Naming error HOT 10
- Can't build Examples/OAuth2Sample HOT 2
- GTMOAuth2-iOS target copies Info.plist as a bundle resource. HOT 2
- Is GTMOAuth2WindowController something we can still use after the embedded webview deprecation? HOT 2
- authorizeFromKeychainForName: API calls fails in mac app extension. HOT 3
- My app crash when calling "GIDSignIn.sharedInstance().signIn()" at second run or another later HOT 5
- Error uploading file to Google Drive iOS with new Auth guideline HOT 1
- Warnings against Swift 4 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gtm-oauth2.