如何使用 Swift 和 iOS 使用 Facebook 身份验证注销用户? [英] How to logout user using Facebook authentication using Swift and iOS?

查看:28
本文介绍了如何使用 Swift 和 iOS 使用 Facebook 身份验证注销用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过四处寻找,但找不到问题的答案.

I've tried searching around but I can't find the answer to my question.

我正在使用 github 上的这个应用程序:https://github.com/Yalantis/Koloda/tree/master/Example

I'm playing around with this application from github: https://github.com/Yalantis/Koloda/tree/master/Example

我使用它是因为我正在做一个项目,该项目将使用来自该应用程序的基于磁贴的滑动.

I'm using it because I'm doing a project which will use the tile based swiping from this application.

我也在使用 firebase.到目前为止,我可以将用户添加到我的数据库中,因此应用程序和 Firebase 已连接.

I'm also using firebase. So far, I can add users to my database, so the app and firebase are connected.

我还希望用户使用 Facebook 注册/登录.

I also want users to register/login using facebook.

我已将我的应用程序连接到 facebook,用户可以进入并使用 facebook 身份验证成功登录.

I have connected my app to facebook and a user can come in and successfully login using facebook authentication.

我遇到的问题是注销.

当我单击注销按钮时,我希望用户完全注销.因此,facebook SDK 附带了一个注销方法,称为注销.这是我的代码的相关部分.

When I click on the logout button, I want the user to be completely logged out. So there is a logout method that comes with the facebook SDK called logout. Here are the relevant parts of my code.

import FBSDKLoginKit
@IBAction func handleLogout(sender: AnyObject) {

    facebookLogin.logOut()
    print("loggedout")
    }

所以当我点击注销然后再次点击登录时,我得到了这个页面:

So when I click on logout and then click on login again I get this page:

http://imgur.com/owi3zZn

我不希望用户在点击注销按钮后保持授权状态.我如何做到这一点,当我点击退出按钮时,用户完全从 Facebook 退出,然后当他们点击登录按钮时,他们必须重新输入他们的用户名/密码?

I do not want the user to stay authorized after they have clicked on the logout button. How do I make it so that when I click on the logout button, the user is completely logged out from Facebook and then when they click on the login button they have to re-enter their username/password?

我已经尝试环顾 webz,但找不到解决我的问题的方法,尽管我确信这很简单,但我希望!

I've tried looking around the webz but can't find a solution to my problem, although I'm sure it's something pretty simple, I hope!

感谢您的帮助,如果格式不佳,请见谅.

Thank you for your help and sorry if the formatting is poor.

推荐答案

当您调用 logOut 时,用户将从您的应用程序中注销.至于将他们从 Facebook 注销,我认为你不能这样做,Facebook 也不会允许这样做.用户第一次通过 Facebook 授权您的应用程序时,Facebook 会将您的应用程序添加到他们获得授权的应用程序列表中(他们可以通过 Facebook.com 访问该页面).当他们注销并再次登录时,他们将看到您发布图片的页面,因为他们已经对其进行了授权.他们重新授权自己的唯一方法是从他们的 Facebook 应用页面中删除该应用,然后重新登录您的应用.

When you call the logOut, the user is logged out of your app. As far as logging them out of Facebook, I don't think you can do that, nor would Facebook allow it. The first time a user authorizes you app through Facebook, Facebook adds your app to the list of apps that they are authorized with (they can access that page through Facebook.com). When they logOut and logIn again, they will see the page that you posted a picture of because they already authorized it. The only way for them to reauthorize themselves is to delete the app from their Facebook app page and log in to your app again.

这篇关于如何使用 Swift 和 iOS 使用 Facebook 身份验证注销用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆