以编程方式通过堆栈溢出进行身份验证 [英] Authenticating with Stack Overflow programmatically

查看:104
本文介绍了以编程方式通过堆栈溢出进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对我的iPhone应用程序进行上下投票- MyStacks .为此,我需要能够通过Stack Overflow对用户进行身份验证.

I would like to add up and down voting to my iPhone application - MyStacks. for this I need the to be able to authenticate the user with Stack Overflow.

我正在尝试改编 Twitter-OAuth-iPhone 库.但是,我遇到的问题是获取使用者和密钥.要使用OAuth,我需要为每个提供程序获取一个不同的密钥吗?为了从Google 获取使用者密钥,应用程序需要具有域名,但这作为iPhone应用程序,我当然没有.这是否意味着我不能使用OAuth?

I'm look at adapting the Twitter-OAuth-iPhone library. However the problem I have is obtaining the consumer and secret key. to use OAuth, do I need to obtain a different key for each provider? In order to obtain a consumer key from Google the application needs to have a domain name, but this being an iPhone app of course I don't have one. Does this mean that I can't use OAuth?

还有其他方法可以通过堆栈溢出以编程方式进行身份验证吗?

Is there any other way to programmatically authenticate with Stack Overflow?

推荐答案

在iPhone上找到了非常简单的解决方案.只需嵌入一个UIWebView即可打开SO登录页面,然后用户进行身份验证后,所需的cookie将使用NSHTTPCookieStorage保存,因此您可以像往常一样简单地使用NSURLRequest.

Found the solution, on the iPhone its surprisingly simple. Just embed a UIWebView which opens up the SO login page and then once users authenticates themselves the required cookies will be saved using NSHTTPCookieStorage so you can simply use NSURLRequest as normal.

这篇关于以编程方式通过堆栈溢出进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆