[GH-ISSUE #130] Logout process #81

Closed
opened 2026-03-03 16:45:30 +03:00 by kerem · 7 comments
Owner

Originally created by @lokatorius on GitHub (Oct 21, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/130

Hello,

I was trying to make logout functionality with oauthswift. But I was not able to figure out how to do it.
Now it is connecting automatically every time. How to switch users?

Thank you for your help.

Originally created by @lokatorius on GitHub (Oct 21, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/130 Hello, I was trying to make logout functionality with oauthswift. But I was not able to figure out how to do it. Now it is connecting automatically every time. How to switch users? Thank you for your help.
kerem 2026-03-03 16:45:30 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@phimage commented on GitHub (Oct 21, 2015):

did you use a webview? sometimes cookies must be deleted to change user

then you could recreate an OAuthSwift object
or edit credential : reset oauth_token, oauth_token_secret and maybe other things

depending on the used api, you could revoke the token before doing that

edit: I wil close until you don't answer, but I can reopen If you want

<!-- gh-comment-id:150023114 --> @phimage commented on GitHub (Oct 21, 2015): did you use a webview? sometimes cookies must be deleted to change user then you could recreate an OAuthSwift object or edit credential : reset oauth_token, oauth_token_secret and maybe other things depending on the used api, you could revoke the token before doing that edit: I wil close until you don't answer, but I can reopen If you want
Author
Owner

@lokatorius commented on GitHub (Nov 15, 2015):

Thank you for the answer it solved the issue.

<!-- gh-comment-id:156814699 --> @lokatorius commented on GitHub (Nov 15, 2015): Thank you for the answer it solved the issue.
Author
Owner

@sourov2008 commented on GitHub (Feb 28, 2016):

Hey I am using webview and trying to make logout functionality with oauthswift
After first login web view appear as a blank and immediately open an alert box for confirming open the app .

I have a Disconnect/Logout button in my apps . When user tap the button I tried to delete the cookies

        NSURLCache.sharedURLCache().removeAllCachedResponses()
        if let cookies = NSHTTPCookieStorage.sharedHTTPCookieStorage().cookies {
            for cookie in cookies {
                NSHTTPCookieStorage.sharedHTTPCookieStorage().deleteCookie(cookie)
            }
        }

But not working .
I have tried to reset oauth_token, oauth_token_secret .
but nothing work properly .

<!-- gh-comment-id:189794562 --> @sourov2008 commented on GitHub (Feb 28, 2016): Hey I am using webview and trying to make logout functionality with oauthswift After first login web view appear as a blank and immediately open an alert box for confirming open the app . I have a Disconnect/Logout button in my apps . When user tap the button I tried to delete the cookies ``` NSURLCache.sharedURLCache().removeAllCachedResponses() if let cookies = NSHTTPCookieStorage.sharedHTTPCookieStorage().cookies { for cookie in cookies { NSHTTPCookieStorage.sharedHTTPCookieStorage().deleteCookie(cookie) } } ``` But not working . I have tried to reset oauth_token, oauth_token_secret . but nothing work properly .
Author
Owner

@phimage commented on GitHub (Feb 28, 2016):

There is two type of webview, say the class name...

<!-- gh-comment-id:189797152 --> @phimage commented on GitHub (Feb 28, 2016): There is two type of webview, say the class name...
Author
Owner

@sourov2008 commented on GitHub (Feb 28, 2016):

Still now I am using OAuthSwiftDemo
and it seems using WebViewController.swift class ->UIViewController->UIWebView

<!-- gh-comment-id:189803652 --> @sourov2008 commented on GitHub (Feb 28, 2016): Still now I am using OAuthSwiftDemo and it seems using WebViewController.swift class ->UIViewController->UIWebView
Author
Owner

@phimage commented on GitHub (Feb 29, 2016):

try also reset cache

and after deleting cookies, do a NSUserDefaults standardUserDefaults synchronize 'i read on stackoverflow

<!-- gh-comment-id:190203598 --> @phimage commented on GitHub (Feb 29, 2016): try also reset cache and after deleting cookies, do a NSUserDefaults standardUserDefaults synchronize 'i read on stackoverflow
Author
Owner

@Rushabh5 commented on GitHub (Jan 27, 2025):

@lokatorius How did you achieve this? Can you please share your code here for logout process?

<!-- gh-comment-id:2615021623 --> @Rushabh5 commented on GitHub (Jan 27, 2025): @lokatorius How did you achieve this? Can you please share your code here for logout process?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#81
No description provided.