Auth0 Home Blog Docs

How to Logout the user completely in iOS Device?

logout
auth0
ios
native
#1

I have integrated iOS Swift SDK

Auth0
.webAuth()
.scope("openid profile")
.audience("https://abc.com/userinfo")
.start {
    switch $0 {
    case .failure(let error):
        // Handle the error
        print("Error: \(error)")
    case .success(let credentials):
        // Do something with credentials e.g.: save them.
        // Auth0 will automatically dismiss the login page
        print("Credentials: \(credentials)")
    }

}

How to log out the user completely in the device?

Is the only way available right now is clearing the credentials we stored after a successful login?

I can see a logOut method available in react native app, that’s where the confusion arises!

auth0
.webAuth
.logout()
.then(credentials =>
  console.log(credentials)
  // Successfully authenticated
  // Store the accessToken
)
.catch(error => console.log(error));
#2

Hey there!

Not sure what logout() method implements under the hood by judging by our iOS docs on logout:

the way to do it is as you said to clear the keychain.

Hope it helps!

1 Like
closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.