{"action":"created","issue":{"url":"https://api.github.com/repos/felix-dumit/PFUser-Digits/issues/13","labels_url":"https://api.github.com/repos/felix-dumit/PFUser-Digits/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/felix-dumit/PFUser-Digits/issues/13/comments","events_url":"https://api.github.com/repos/felix-dumit/PFUser-Digits/issues/13/events","html_url":"https://github.com/felix-dumit/PFUser-Digits/issues/13","id":122659600,"number":13,"title":"PFUser never logs out and Can't bring back Digits Signup Flow","user":{"login":"otymartin","id":2222881,"avatar_url":"https://avatars.githubusercontent.com/u/2222881?v=3","gravatar_id":"","url":"https://api.github.com/users/otymartin","html_url":"https://github.com/otymartin","followers_url":"https://api.github.com/users/otymartin/followers","following_url":"https://api.github.com/users/otymartin/following{/other_user}","gists_url":"https://api.github.com/users/otymartin/gists{/gist_id}","starred_url":"https://api.github.com/users/otymartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otymartin/subscriptions","organizations_url":"https://api.github.com/users/otymartin/orgs","repos_url":"https://api.github.com/users/otymartin/repos","events_url":"https://api.github.com/users/otymartin/events{/privacy}","received_events_url":"https://api.github.com/users/otymartin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-17T04:39:19Z","updated_at":"2015-12-17T14:46:32Z","closed_at":null,"body":"Two issues:\r\nAfter initially signing up my PFUser, I can never get them to logout with any logout method.\r\nEven after deleting the sessions and user in the Parse dashboard, the user still persists somewhere - magic. I occasionally get \"Invalid session Token\" errors.\r\n\r\nThat brings another issue:\r\nI can't seem to bring back the Digits signup flow after initially creating a user on any given device.\r\nThe first time I try to signup -> I get the digitsSignup Flow.\r\nOnce I logout and try again, that Flow no longer shows up. Instead I'm automatically logged in. No matter what I do, that Digits Flow is lost for good for some reason.\r\n------------------------------------------------------------------------------------------------------------------\r\n\r\nclass LoginSignupViewController: UIViewController {\r\n override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        \r\n        //If there is a user currently logged in, send them to the InitialViewController\r\n        if PFUser.currentUser() != nil {\r\n            dispatch_async(dispatch_get_main_queue()) {\r\n            self.performSegueWithIdentifier(\"ShowInitialVC\", sender: self)\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n//Digits login method\r\n    @IBAction func loginSignupButton(sender: AnyObject) {\r\n        \r\n        PFUser.loginWithDigitsInBackground { (user:PFUser?, error:NSError?) -> Void in\r\n            if error == nil {\r\n                \r\n                dispatch_async(dispatch_get_main_queue()) {\r\n                    self.performSegueWithIdentifier(\"ShowInitialVC\", sender: self)\r\n                }\r\n\r\n            } else {\r\n                print(\"there was an error\")\r\n            }\r\n        }\r\n    }\r\n\r\n//MY LOGOUT METHOD\r\nclass InitialViewController: UIViewController {\r\n    \r\n    @IBAction func logoutButton(sender: AnyObject) {\r\n        \r\n        PFUser.logOutInBackground()\r\n       \r\n         //Go back to root view controller\r\n        let mainStoryboard = UIStoryboard(name: \"Main\", bundle: nil)\r\n        let loginSignupViewController = mainStoryboard.instantiateViewControllerWithIdentifier(\"LoginSignupViewController\")\r\n        presentViewController(loginSignupViewController, animated: true, completion: nil)\r\n    }\r\n\r\n//PFUser+Digits.swift extension goes here!\r\n"},"comment":{"url":"https://api.github.com/repos/felix-dumit/PFUser-Digits/issues/comments/165470236","html_url":"https://github.com/felix-dumit/PFUser-Digits/issues/13#issuecomment-165470236","issue_url":"https://api.github.com/repos/felix-dumit/PFUser-Digits/issues/13","id":165470236,"user":{"login":"otymartin","id":2222881,"avatar_url":"https://avatars.githubusercontent.com/u/2222881?v=3","gravatar_id":"","url":"https://api.github.com/users/otymartin","html_url":"https://github.com/otymartin","followers_url":"https://api.github.com/users/otymartin/followers","following_url":"https://api.github.com/users/otymartin/following{/other_user}","gists_url":"https://api.github.com/users/otymartin/gists{/gist_id}","starred_url":"https://api.github.com/users/otymartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otymartin/subscriptions","organizations_url":"https://api.github.com/users/otymartin/orgs","repos_url":"https://api.github.com/users/otymartin/repos","events_url":"https://api.github.com/users/otymartin/events{/privacy}","received_events_url":"https://api.github.com/users/otymartin/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T14:46:32Z","updated_at":"2015-12-17T14:46:32Z","body":"Fixed.\r\n@arjun hit me up on slack ios-developers group and sent me this `Digits.sharedInstance.logOut()` which I added right underneath my `PFUser.logOut()` method.\r\nAll my problems disappeared.\r\n\r\nI think what was happening was although PFUser.logOut ended the PFUser session associated with PFUser.currentUser, a session still persisted with the DigitsAPI which you have to explicitly end.\r\n\r\nHence `Digits.sharedInstance.logOut()` \r\n\r\nI'm new to programming so I hope I framed the problem and solution correctly. Someone please check me on that if I'm wrong.\r\n\r\nThanks"}}