From the course: Learning AWS Amplify (2020)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

How to add user logout

How to add user logout - Amazon Web Services (AWS) Tutorial

From the course: Learning AWS Amplify (2020)

Start my 1-month free trial

How to add user logout

- [Instructor] Okay, so here's the solution to the challenge, I hope you enjoyed that, I hope you learned something, and feel more confident than ever in it. So here's what we're going to do for the log out functionality. I'm just going to write on line 64, AWSMobileClient.default().signOut. Now, there's one that takes the completion handler, so let's do that one. And we're going to check for the error, so I'll say error. And in the code we're going to say, guard error == nil else {return}. Something like that. But otherwise we'll assume they actually logged out, and we'll call self.checkSignIn(). So that way if they logged out successfully, it should display the UI again, by checking to see if they are logged in. So let's run this, and log out and see if it works. So I'll run the app in the simulator. Okay, so we're checkin' the sign in. The user signed in, so it goes straight here. Then if we click log out, we should…

Contents