简体   繁体   English

如何实现简单的Android OAuth和服务器API

[英]how to implement a simple Android OAuth and server API

i have an android app that sends data to my web server (data is processed by php and stored in mysql db). 我有一个Android应用程序,它将数据发送到我的Web服务器(数据由php处理并存储在mysql db中)。 for security reasons, i need to verify that the user sending the data is who he/she says he/she is. 出于安全原因,我需要验证发送数据的用户是否是他/她所说的那个人。

i do not want to verify login/password, i would rather use the phone's registered (account manager) google account with something like federated login. 我不想验证登录名/密码,我宁愿使用手机的已注册(帐户管理器)的Google帐户进行联合登录。 i played around with nick johnson's example for GAE , but it is specific for GAE based apps and does not permit integration with my own server API's, therefore authentication does not work (i get a google authToken, but it is meaningless for my server API). 我使用了nick johnson的GAE示例 ,但它特定于基于GAE的应用程序,并且不允许与我自己的服务器API集成,因此身份验证不起作用(我获得了google authToken,但对我的服务器API毫无意义) 。

from what i understand, the safest+simplest solution would be to use OAuth. 据我了解,最安全+最简单的解决方案是使用OAuth。

but i am completely stumped trying to understand OAuth (i understand its concepts, but have not been able to find any example that i could implement). 但我完全无法理解OAuth(我了解它的概念,但无法找到我可以实现的任何示例)。

does anyone have anything like a functional example that i could play around with and tweak for my needs? 有没有人能像我这样的功能示例,可以根据需要进行调整? thanx in advance! 提前谢谢!

if not done already, you could check this page which explains how to implement oauth server with php/mysql 如果尚未完成,则可以检查此页面,该页面说明了如何使用php / mysql实现oauth服务器

http://phpmaster.com/creating-a-php-oauth-server/ http://phpmaster.com/creating-a-php-oauth-server/

if you play with symfony2 as backend 如果您使用symfony2作为后端

https://github.com/FriendsOfSymfony/FOSOAuthServerBundle https://github.com/FriendsOfSymfony/FOSOAuthServerBundle

i hope this helped 我希望这会有所帮助

每当用户首次登录或使用您的应用程序时,您都应捕获其设备的mac地址,并将其存储到数据库中,并且可以轻松地使用此mac地址对用户进行身份验证

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM