I want my PFSessions to be exclusive, meaning, If a user is already logged in on a certain device in a certain location, if another device logs in with the same credentials, I want the previous session to be terminated, with a message of an alert view of course. Sort of like the old AOL Instant Messaging format. so does anyone know how I would go about doing so in swift? would it require CoreLocation?
I found this article on current user location, how can I use this as part of a solution to my question ?
https://www.veasoftware.com/tutorials/2014/10/18/xcode-6-tutorial-ios-8-current-location-in-swift
UPDATE
so I've just read this parse article on their revocable sessions settings
http://blog.parse.com/announcements/announcing-new-enhanced-sessions/
however, when I log into the same account with a different device, the sessions are allowed to live correspondingly, which i do not want. How do I solve my dilemma?
UPDATE
I've gotten this very detailed description on how to achieve the overall method I'm trying to implement :
however I am not very well versed in cloud code implementation, can someone very briefly portray a piece of code that is similar to what he's trying to relay onto me?
UPDATE
So I did some more research and tied in what I was told in regards on how to use the cloud code calls in parse, and being I want to destroy previous sessions of the currentUser, I've written the following code in my login "success" logic:
PFUser.logInWithUsernameInBackground(userName, password: passWord) {
(user, error: NSError?) -> Void in
if user != nil || error == nil {
dispatch_async(dispatch_get_main_queue()) {
self.performSegueWithIdentifier("loginSuccess", sender: self)
PFCloud.callFunctionInBackground("currentUser", withParameters: ["PFUser":"currentUser"])
//..... Get other currentUser session tokens and destroy them
}
} else {
If thats even the correct format or code, but I’m sure this is the right direction right? Can anybody edit or expand on the code I'm trying to achieve?
http://stackoverflow.com/questions/34620442/is-there-a-way-to-enforce-single-device-login-on-parse-com
– Markus Jan 09 '16 at 04:55