Rails 设计 OmniAuth Facebook 从 iOS 登录 [英] Rails Devise OmniAuth Facebook Login from iOS

查看:36
本文介绍了Rails 设计 OmniAuth Facebook 从 iOS 登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找解决此问题的可靠方法,并且遇到了这个SO 问题哪种符合我的困境,但不完全是.

目前,我的 iPhone 应用程序通过基本身份验证使用 Rails API 进行身份验证.这只是您简单的、普通的设计认证包.然后我按照说明为设计设置 omniauth-facebook 并使其在浏览器端工作.

我不知道该怎么做的部分是如何将在 iPhone 端(通过 Facebook iOS SDK)收到的令牌发送到服务器.我希望服务器检查用户表以查看该 facebook 用户是否已注册,如果他还没有注册,则为他创建一个帐户.然后,我认为服务器会生成一个随机密码并将其发送回客户端设备,以便我可以保持相同的基本身份验证策略.这是为 Web 应用程序和 iPhone 应用程序实现单点登录的正确方法吗?如何修改服务器端包以通过从手机发送的令牌支持身份验证?

解决方案

你可能想看看这里:

开源:宣布 devise-iOS 用于简化身份验证

使用 Rails/Devise 和 iOS 看起来是一种相对轻松的方式.我绝对计划在我的下一个项目中使用它.

I've been searching for a solid solution to this problem, and came across this SO question which kind of matches my predicament, but not exactly.

Currently I have my iPhone application authenticating with my Rails API via Basic Auth. It's just your simple, run-of-the-mill devise auth package. I then followed the instructions to set up omniauth-facebook for devise and got that working on the browser side.

The part I can't figure out how to do is how to send the token received on the iPhone side (via the Facebook iOS SDK) to the server. I want the server to check the users table to see if that facebook user has signed up, and create an account for him if he hasn't. Then, I was thinking the server would generate a random password and send it back to the client device so that I could keep my same basic authentication strategy. Is this the proper way to implement single sign on for a web app and iPhone app? How would one go about modifying the server side packages to support authentication via a token sent from the phone?

解决方案

You may want to take a look here:

Open Source: Announcing devise-iOS For Simplified Auth

It looks like a relatively painless way to work with Rails / Devise and iOS. I definitely plan on using it in my next project.

这篇关于Rails 设计 OmniAuth Facebook 从 iOS 登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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