没有社交框架的 Twitter 登录

编程入门 行业动态 更新时间:2024-10-28 09:22:49
本文介绍了没有社交框架的 Twitter 登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在我的 ios 应用中实现 twitter 登录.我不想使用社交框架.我已经尝试了所有方法来登录 twitter,但不幸的是这不起作用.主要是我面临其中的回调 url 问题.你能帮我吗.

I am trying to implement twitter login in my ios app. I do not want to use social frame work. I have tried all ways to twitter login but unfortunately this not working. Mainly i am facing the callback url issue in it. Can you please guys help me.

我也试过这个网址

codegerms/login-with-twitter-example-with-ios-tutorial-using-oauth/

但主要是我面临回调问题.任何人都可以请推荐其他插件.

but mainly i am facing the callback issue. Can any one please suggest other plugin.

推荐答案

要从 Twitter 获取用户信息,您可以使用 OAuth.io 的 iOS SDK:github/oauth-io/oauth-ios

To get the user's information from Twitter, you can use OAuth.io's iOS SDK: github/oauth-io/oauth-ios

在 oauth.io 上创建帐户并添加 Twitter 作为提供商后,您将能够很容易地获取用户的信息.您只需按照以下步骤操作:

After having created an account on oauth.io, and added Twitter as a provider, you'll be able to get the user's info quite easily. You just need to follow these steps:

通过可可豆荚:

$ pod install "OAuth.io"

手动:

只需获取 OAuthiOS.framework 文件 在这里并像安装任何其他框架一样安装它.

Just get the OAuthiOS.framework file here and install it like any other framework.

在您的 ViewController 中添加 #import .

Add #import <OAuthiOS/OAuthiOS.h> in your ViewController.

@interface MyViewController : UIViewController<OAuthIODelegate> //[...] @end

4 在 ViewController 中初始化并启动身份验证弹出窗口:

4 Initialize and launch an authentication popup in the ViewController:

OAuthIOModal *oauthioModal = [[OAuthIOModal alloc] initWithKey:@"your_app_public_key" delegate:self]; [oauthioModal showWithProvider:@"twitter"];

5 实现以下委托方法来获取请求对象,这让您可以检索用户的信息,感谢 me 方法:

5 Implement the following delegate method to get a Request Object, that lets you retrieve the user's information, thanks to the me method:

- (void)didReceiveOAuthIOResponse:(OAuthIORequest *)request { [_request me:nil success:^(NSDictionary *output, NSString *body, NSHTTPURLResponse *httpResponse) { NSLog(@"name: %@", [output objectForKey:@"name"]); }]; }

要获取有关 iOS SDK 的更多信息,请随时查看此处的指南:

To get more information about the iOS SDK, feel free to check out the guide here:

oauth.io/getting-started?ios&None

您也可以在此处遵循基于 git 的教程:

You can also follow a git based tutorial here:

oauth.io/docs/tutorials/client/ios

并在此处找到 SDK 的参考文档:

And find the reference documentation of the SDK here:

oauth.io/docs/api-reference/client/ios

请注意,OAuth.io 还在 oauthd 项目中开源了它们的核心(查看这里的 repo:github/oauth-io/oauthd)

Note that OAuth.io also open sourced their core in the oauthd project (check out the repo here: github/oauth-io/oauthd)

希望这有帮助:)

更多推荐

没有社交框架的 Twitter 登录

本文发布于:2023-07-15 01:53:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1108316.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:社交   框架   Twitter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!