
Parse Server docs提供了有关如何配置OAuth模块的示例.但是如何在iOS项目中使用它来登录或注册用户?
解决方法 1,创建一个从NSObject和PFUserAuthenticationDelegate扩展的类.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中验证用户?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)