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.logInWithAuthType(inBackground: "google", authdata:[.....])
4,您将看到在_User中创建一条记录,其中只有objectId和authData



