大佬教程收集整理的这篇文章主要介绍了如何使用OAuth在Parse iOS SDK中验证用户?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Parse Server docs提供了有关如何配置OAuth模块的示例.但是如何在iOS项目中使用它来登录或注册用户?
class AuthDelegate:NSObject,PFUserAuthenticationDelegate { func restoreAuthenticationWithAuthData(authData: [String : String]?) -> Bool { return true } }
2,注册此身份验证委托
// parmeter 'forAuthType' is the name of file defined in // https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/index.js // such as: google,github,linkedin ...... PFUser.registerAuthenticationDelegate(AuthDelegate(),forAuthType: "google")
3,使用PFUser.logInWithAuthTypeInBACkground方法将用户信息存储到_User
// for google oauth,authData format will be // ["id":"PUT_user_iD_HERE","accesstoken":"PUT_TOKEN_HERE"] PFUser.logInWithAuthTypeInBACkground("google",authData:[.....])
4,您将看到在_User中创建的记录,只有objectId和authData
以上是大佬教程为你收集整理的如何使用OAuth在Parse iOS SDK中验证用户?全部内容,希望文章能够帮你解决如何使用OAuth在Parse iOS SDK中验证用户?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。