Can we implement a openID options in a Native iPhone App?

十年热恋 提交于 2019-12-28 11:46:32

问题


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 !!


回答1:


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.



来源:https://stackoverflow.com/questions/3448863/can-we-implement-a-openid-options-in-a-native-iphone-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!