dongmao3148 2017-07-21 17:25
浏览 60
已采纳

Swift iOS应用程序到REST PHP API - 身份验证的最佳实践是什么?

I'm in the process of building a iOS mobile application in Swift. I have a RESTFUL API written in PHP which communicates between the mobile application and a database. Everything is working perfectly.

The problem I've got is, I don't know what the best practice is for authentication. I eventually want users to sign up for an account on my application, but I'd like to have the user enter login credentials as little as possible, so some kind of authentication/authorisation key would be preferred.

I see so many different recommendations when I've looked for an answer, yet can't seem to find a tutorial or set of tutorials that cover what I need.

Can you guys link me some sources on how I'd go about achieving the above?

  • 写回答

1条回答 默认 最新

  • douqiao1887 2017-07-21 17:33
    关注

    Oauth2 is great for this. Oauth2 is what powers the 'log in through Google' buttons you will see all over the web. Effectively, the user would log in to your API through the iOS app and the app would send a token to the server with every request.

    See the getting started page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里