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 python怎么在已有视频文件后添加新帧
  • ¥20 虚幻UE引擎如何让多个同一个蓝图的NPC执行一样的动画,
  • ¥15 fluent里模拟降膜反应的UDF编写
  • ¥15 MYSQL 多表拼接link
  • ¥15 关于某款2.13寸墨水屏的问题
  • ¥15 obsidian的中文层级自动编号
  • ¥15 同一个网口一个电脑连接有网,另一个电脑连接没网
  • ¥15 神经网络模型一直不能上GPU
  • ¥15 pyqt怎么把滑块和输入框相互绑定,求解决!
  • ¥20 wpf datagrid单元闪烁效果失灵