Auth0 Home Blog Docs

iOS Swift SDK clearSession() not working as intended

ios

#1

Language: Swift4

Login Implementation: Using Auth0 Swift SDK.

Test Platforms: iOS11 simulator, iPhone6 Plus running iOS10

Integrated Social Platforms: Google, Microsoft Live

Intention: Want to log the user out on the application level and clear SSO session after the user pressed the log out button, so the next time they want to log in, they would have to enter in their social credentials in a SafariViewController.

Current Implementation:

Auth0.webAuth().clearSession(federated: false) { (isLoggedOut) in
        if isLoggedOut{
            DispatchQueue.main.async {
                let keychain = A0SimpleKeychain(service: "Auth0")
                keychain.clearAll()
               //Perform UI Updates
                })
            }
        }
    }

Current Behavior(Not what I am expecting): When tapping on the login with Google button on the login page, it doesn’t ask for credentials, and logs in the user directly. (Which would be the intended and expected behavior if I didn’t clear the SSO session.)

Question: Is the clearSession() API under the WebAuth protocol working as intended? or Am I misusing it?


#2

Hi ,
I am also facing the same issue with Auth0 cleatAll()
Please let me know if anybody knew the solution.

Thanks,
Venkat


#3

Hello there,
I actually checked into their Github branch for the Swift SDK. It seems like there are failed tests with the clearSession() API. I think they are working on a new implementation using the new SafariAuthtenticationVC. I suggest following their GitHub Swift branch for the latest updates.


#4

It is kind of weird that they haven’t addressed this issue yet :frowning:


#5