Play! Framework 2 REST Authentication and Authorization for Android Client

旧街凉风 提交于 2020-01-13 16:55:47

问题


I'm currently working on an application that has web version (Play! Framework 2.2.x) and Android Client. Due to the fact that Play! is fully RESTful I want to communicate between Play! and Android with JSON requests and responses. Web version of the application is using Play Authenticate plugin which supports authentication and authorization. I would like to know how to enable login in Android Client that would use Play! app and how to secure the communication between Play! app and Android Client.


回答1:


After not getting a reply for my question I figured out the following solution. Each user has it's own name and password and a token. This token is being set during registration and gets updated every two days. I save username and token inside shared preferences in android application and authenticate each request from client with those two fields. Since it was a student project I thought it might be a good choice, but the production product should have better security.



来源:https://stackoverflow.com/questions/23328266/play-framework-2-rest-authentication-and-authorization-for-android-client

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