Re: Serialize GTMOAuth2Authentication into the disk

236 views
Skip to first unread message

Greg Robbins

unread,
Jun 30, 2012, 12:34:34 PM6/30/12
to gtm-o...@googlegroups.com
The assertion at that line indicates that a fetch to an invalid URL is being made. Set a breakpoint there to find out where the URL for that fetch originates.

iPepito

unread,
Oct 4, 2012, 7:00:07 AM10/4/12
to gtm-o...@googlegroups.com
Hi Greg, 
I have still the same problem in the method 

- (BOOL)fetcherShouldBeginFetching:(GTMHTTPFetcher *)fetcher

NSString *host = [[[fetcher mutableRequest] URL] host];

if ([host length] == 0) {

#if DEBUG

    NSAssert1(0, @"%@ lacks host", fetcher);

#endif

    return YES;

}

According to my debug information host is nil. 

Just changing authentication persistence to keychain everything works like a charm. 

What is wrong with my implementation of NSCoding?


On Monday, July 2, 2012 12:12:10 PM UTC+2, iPepito wrote:
The URL is nil, I also noticed that the userEmail for the authToken is nil. 
It seems that I'm doing something wrong in the store/restore....

iPepito

unread,
Oct 4, 2012, 7:18:49 AM10/4/12
to gtm-o...@googlegroups.com
I finally resolve this! The problem was the way I was creating the authToken.
O changed the line:

GTMOAuth2Authentication *theAuthToken = [[[GTMOAuth2Authentication alloc] init] autorelease];

with :

Class signInClass = [GTMOAuth2WindowController signInClass];

NSURL *tokenURL = [signInClass googleTokenURL];

NSString *redirectURI = [signInClass nativeClientRedirectURI];

GTMOAuth2Authentication *theAuthToken;

 theAuthToken = [GTMOAuth2Authentication authenticationWithServiceProvider:kGTMOAuth2ServiceProviderGoogle

                                                                 tokenURL:tokenURL

                                                              redirectURI:redirectURI

                                                                 clientID:myClientID

                                                             clientSecret:myClientSecret];

Reply all
Reply to author
Forward
0 new messages