简体   繁体   English

FBSDK检查用户是否已经授权应用程序Swift

[英]FBSDK check if user has already authorised app Swift

I'm setting up log in with facebook, and what I am trying to do is when the user authorises the app for the first time they get segued to a new VC where they select a username. 我正在设置登录facebook,我想要做的是当用户第一次授权应用程序时,他们会被选择一个用户名的新VC。

But if that user logs out and then logs in again with facebook I dont want him to go to the new vc where he selects a username but the Homepage.... 但是,如果该用户退出然后再次登录facebook我不希望他去新的vc,他选择用户名但主页....

Not sure how this is done and haven't been able to find any posts about this apart from how to check if user is logged in.... 不知道如何做到这一点,除了如何检查用户是否登录之外,还没有找到任何关于此的帖子....

Thanks in advance to anyone! 在此先感谢任何人!

Facebook isn't going to tell you that you have logged with this app earlier or not. Facebook不会告诉你,你之前是否已使用此应用程序登录。

What you can do, try like below things. 你可以做什么,尝试下面的事情。

  • (1) Successfully login with Facebook (1)使用Facebook成功登录
  • (2) Get required information from Facebook like - email, id & name. (2)从Facebook获取所需信息,如电子邮件,身份证和姓名。
  • (3) Call login API, pass above information in login API and 1 flag "LoggedIn_Facebook" (3)调用登录API,在登录API中传递上述信息,并标记“LoggedIn_Facebook”1
  • (4) If above information coming 1st time on server code via API, then make registration of user, provide appropriate response from API and redirect to homescreen (4)如果上述信息通过API第一次出现在服务器代码上,则进行用户注册,从API提供适当的响应并重定向到主屏幕
  • (5) Next time when you do above process, server code will consider this user as logged in, provide appropriate response from API and redirect to homescreen. (5)下次执行上述过程时,服务器代码会将此用户视为已登录,从API提供适当的响应并重定向到主屏幕。

I hope you understand the process. 我希望你理解这个过程。

Have a happy coding. 有一个快乐的编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM