Login and mantaign session from ios app to a symfony2 web application

不羁岁月 提交于 2019-12-06 08:02:13

问题


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

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.

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.

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.

Thanks in advance


回答1:


It's better to rely on a stateless authentication.

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.

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



来源:https://stackoverflow.com/questions/12347319/login-and-mantaign-session-from-ios-app-to-a-symfony2-web-application

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