# Swift log-out function not working correctly

**URL:** <https://community.auth0.com/t/swift-log-out-function-not-working-correctly/19968>\
**Category:** Get Help\
**Tags:** auth0swift, xcode, swift, ios\
**Created:** [January 14, 2019, 4:02pm UTC](https://community.auth0.com/t/swift-log-out-function-not-working-correctly/19968 "2019-01-14T16:02:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MauriceZedde](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mauricezedde/32/10427_2.png) [@MauriceZedde](https://community.auth0.com/u/MauriceZedde)\
**Post date:** [January 14, 2019, 4:02pm UTC](https://community.auth0.com/t/swift-log-out-function-not-working-correctly/19968/1 "2019-01-14T16:02:53Z")

</div>

Hi,

Not sure if I post my question in the correct topic but I have troubles with log-out.  
In the app I use the following code:

Auth0  
.webAuth()  
.clearSession(federated: true) { (Bool) in  
A0SimpleKeychain.init(service: “Auth0”).clearAll()  
SessionManager.shared.credentialsManager.clear()  
}

With this code I call something like “https://.com/v2/logout”  
And I clear the keychain and credentials.

When this is done I redirect to login view and press the login button. However I get signed in again without inserting my username and pasword.

* * *

When I call the “https://.com/v2/logout” url in safari itself it is logging me out completely like it should but when I call the same url again in a web view inside the application, the result is that I am not completely logged out.

Can someone tell me what is the correct way to totally sign-out a user so the user will be prompted for username and password again. 🙂

---

<div class="post-metadata">

**Author:** ![dev16](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dev16](https://community.auth0.com/u/dev16)\
**Post date:** [February 4, 2019, 4:16pm UTC](https://community.auth0.com/t/swift-log-out-function-not-working-correctly/19968/2 "2019-02-04T16:16:02Z")

</div>

> [@MauriceZedde](#):
>
> With this code I call something like “https://.com/v2/logout”  
> And I clear the keychain and credentials.

This seems to be a known issue, already reported in the past. Auth0 didn’t yet provide a solution to the problem.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 29, 2019, 10:27am UTC](https://community.auth0.com/t/swift-log-out-function-not-working-correctly/19968/3 "2019-08-29T10:27:35Z")

</div>


