我们可以在Native iPhone App中实现openID选项吗? [英] Can we implement a openID options in a Native iPhone App?

查看:112
本文介绍了我们可以在Native iPhone App中实现openID选项吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在iPhone中实现OpenId身份验证吗?我找到了一个名为 janrain 的框架。但是通过免费注册,我们只能使用功能。还有其他开源框架吗?



谢谢!!

解决方案

<我找到了一个使用标准UIWebView来处理身份验证的解决方案。由于cookie是在应用程序内共享的,因此使用UIWebView(存储会话或身份验证cookie)的成功身份验证将转移到其他请求。



我没有一个正式的框架,但它的工作原理如下:我发出一个REST请求。如果请求返回一个JSON字符串,那么我已经过身份验证,一切都很好。如果请求返回重定向(即301),则该站点正在尝试重定向以进行身份​​验证。在这里,我停止重定向并使用登录页面呈现模态UIWebView。用户可以使用他们的OpenID登录,一旦用户通过身份验证,就会被重定向到预定的成功URL。



UIWebView - (void) webViewDidFinishLoad:(UIWebView *)webView 委托方法在加载后检查每个URL,并在看到成功URL被请求后解除模态。



<这基本上就是我这样做的方式,似乎有效。


Is is possible to implement OpenId authentication in iPhone? I found a framework named janrain. But with free sign up, we can avail only features. Is there any other open source framework available?

Thanks !!

解决方案

I found a solution that uses a standard UIWebView to handle the authentication. Since cookies are shared within an app, a successful authentication with a UIWebView (that stores a session or authentication cookie) will carry over to other requests.

I don't have a formal framework, but it works like this: I issue a REST request. If the request returns a JSON string, then I'm already authenticated and all is good. If the request returns a redirect (i.e., 301), then the site is trying to redirect for authentication. Here I stop the redirect and present a modal UIWebView with the sign in page. The user can sign in with their OpenID, and once the user is authenticated is redirected to a predetermined success url.

The UIWebView -(void)webViewDidFinishLoad:(UIWebView *)webView delegate method checks each URL after it's loaded, and dismisses the modal once it sees that the success url was requested.

That's basically how I did it and it seems to work.

这篇关于我们可以在Native iPhone App中实现openID选项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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