好的,所以我目前通过以下方式在我的应用中实现了Facebook登录:
我使用官方FB框架登录用户。当我登录时,我收到一个身份验证令牌,它被发送到我的服务器。然后,我对用户进行另一次验证(例如,使用auth-token从Facebook获取“我”),然后返回32个字符随机密钥,用于在后续API调用(到我的服务器)中识别用户。 An example
我正在试图弄清楚如何用twitter做同样的事情,但我无法理解如何在iOS中获得誓言令牌?我有服务器端部分在另一个应用程序中工作,但没有令牌来验证...
请建议 - 这是(FB方式)我应该如何做到这一点,或者你将如何进行验证过程?
答案 0 :(得分:1)
dev.twitter.com上有一篇很好的文章正是如此。基本上,您必须首先通过将x_auth_mode
参数设置为值reverse_aut
来获取特殊请求令牌,然后通过将您在第一步中获得的内容发送为{{1}来获取正确的访问令牌}。
答案 1 :(得分:1)
答案 2 :(得分:-2)
如果您要使用iOS 5
解决方案,可以将其导入头文件
#import < Twitter/TWTweetComposeViewController.h >
然后在.m
文件中进行身份验证
if ([TWTweetComposeViewController canSendTweet])
{
TWTweetComposeViewController* twc = [[TWTweetComposeViewController alloc] init];
[twc addImage:uiImage
[self presentModalViewController:twc animated:YES];
twc.completionHandler = ^(TWTweetComposeViewControllerResult result)
{
if (result == TWTweetComposeViewControllerResultCancelled)
NSLog(@"Tweet compostion was canceled.");
else if (result == TWTweetComposeViewControllerResultDone)
NSLog(@"Tweet composition completed.");
// Dismiss it
[self dismissModalViewControllerAnimated:YES];
};
[twc release];
} else
{
//can't tweet
}
您还可以添加网址,文字和其他类型的信息。
编辑:您可以在此处找到有关向项目添加所需库的教程, https://dev.twitter.com/docs/ios/how-add-twitter-framework-your-ios-project