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

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
    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.

    点赞 评论

相关推荐