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.

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

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程