从ios应用程序登录和mantaign会话到symfony2 Web应用程序 [英] Login and mantaign session from ios app to a symfony2 web application

查看:123
本文介绍了从ios应用程序登录和mantaign会话到symfony2 Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Symfony2开发了一个Web应用程序。我已经使用 FOSUserBundle 来实现用户管理和安全。

I have developed a Web Application using Symfony2. I have used FOSUserBundle for user management and security.

现在我正在考虑为我的网络开发一个原生的iOS APP而不是真的知道如何处理从APP创建会话的问题,并在整个交互用户APP中对其进行管理。

Now I am thinking of developing a native iOS APP for my web and don't really know how to approach the issue of creating a session from the APP and mantaign it throughout the interaction user-APP.

换句话说,我想确保当我执行 NSURLRequest ,不知何故发送会话令牌以允许服务器关联同一会话中的所有请求。

In other words, I want to make sure that when I do a NSURLRequest, somehow the session token is sent to allow the server relate all of the requests in the same session.

在PHP端创建会话时有什么特别的事吗?
处理来自iOS APP的请求时有什么特别的事吗?

Is there anything special to do when creating the session in the PHP side? Is there anything special to do when handling requests from an iOS APP?

你能否提一些好文章来学习如何获得这种方法?我想从开始做好。

Could you mention some good articles to learn on how to get this approach?. I want to do it well from the beggining.

提前致谢

推荐答案

最好依赖无状态身份验证。

It's better to rely on a stateless authentication.

在服务器端,查看 FOSOAuthServerBundle ,它实现了OAuth2的服务器端。该过程将从用户凭证请求api access_token,然后在每个请求上传递access_token。

On the server side, have a look at the FOSOAuthServerBundle that implements the server side of OAuth2 . The process would be to request the api an access_token from the user credentials, and then pass the access_token on each request.

在iOS端,我建议使用 AFNetworking 发出HTTP请求, AFOAuth2Client 请求access_token。

On the iOS side, I recommend using AFNetworking to make HTTP requests, with AFOAuth2Client to request an access_token.

这篇关于从ios应用程序登录和mantaign会话到symfony2 Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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