p2 / OAuth2

OAuth2 framework for macOS and iOS, written in Swift.
Other
1.14k stars 276 forks source link

deleteCookie not working, can you help #349

Closed fukemy closed 2 years ago

fukemy commented 4 years ago

hello, i did called let storage = HTTPCookieStorage.shared storage.cookies?.forEach() { storage.deleteCookie($0) } when logout to loginVC, but in loginVC i start authorized in embedded mode it's still save username/password, can you help?

here is my oauth init

let oauth2 = OAuth2CodeGrant(settings: [
            "client_id": "****",
            "client_secret": "secret",
            "grant_type": "hybrid",
            "authorize_uri": "https://****/connect/authorize",
            "token_uri": "https://****/connect/token",   // code grant only
            "redirect_uris": ["*****"],   // register your own "myapp" scheme in Info.plist
            "scope": "openid profile vxlink email offline_access",
            "secret_in_body": true,    // Github needs this
            "keychain": false,         // if you DON'T want keychain integration
            ] as OAuth2JSON)

        oauth2.logger = OAuth2DebugLogger(.debug)
        oauth2.authConfig.authorizeEmbedded = true
        oauth2.authConfig.authorizeContext = self
        appDelegate.oauth2 = oauth2
        oauth2.authorize(params: ["nonce": UUID.init().uuidString.replacingOccurrences(of: "/-/g", with: ""),"response_type": "code token"]){ authParameters, error in
            if let params = authParameters {
                print("Authorized! Access token is in `oauth2.accessToken`")
                print("Authorized! Additional parameters: \(params)")
                UserDefaults.standard.set(true, forKey: IS_LOGGED_ON)
                UserDefaults.standard.set(params["access_token"], forKey: TOKEN)
                UserDefaults.standard.synchronize()
                DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                    let sb = UIStoryboard(name: "main", bundle: nil)
                    let vc = sb.instantiateViewController(withIdentifier: "HomeVC")
                    vc.modalPresentationStyle = .fullScreen
                    self.present(vc, animated: true, completion: nil)
                }

            }
            else {
                print("Authorization was canceled or went wrong: \(error)")   // error will not be nil
            }
        }
SyedMuneeb29 commented 2 years ago

Still Having this issue is there any update on this ?