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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵