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

查看:294
本文介绍了如何使用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.

我遇到的问题是退出。

当我点击退出按钮时,我想要用户完全注销。所以有一个名为logout的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?

我试过环顾网络,但无法找到问题的解决方案,虽然我确信这很简单,我希望!

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天全站免登陆