简体   繁体   English

Facebook,在没有提示的情况下检查用户对应用的授权

[英]Facebook, Check user authorization to app without prompt

I want to have a "remember me" access to my web app with facebook authorization, and check if the user has authorized my app without asking the user for permissions. 我想通过Facebook授权对我的Web应用程序具有“记住我”的访问权限,并检查用户是否已授权我的应用程序而没有询问用户权限。

I want to ask a new user from facebook for authorization only if the user starts the registration process not just to check for authorization in a first access. 我只想从Facebook询问新用户授权,前提是该用户开始注册过程,而不仅仅是在首次访问中检查授权。

How can I do it? 我该怎么做?

This option is not available through the OAuth URL. 通过OAuth URL不能使用此选项。 I was using Facebook SDK for PHP and the solution is to use it in conjunction with the Facebook SDK for javascript: 我使用的是Facebook SDK for PHP,解决方案是将其与JavaScript的Facebook SDK结合使用:

FB.getLoginStatus allows you to determine if a user is logged in to Facebook and has authenticated your app. FB.getLoginStatus允许您确定用户是否登录到Facebook并已验证您的应用程序。 There are three possible states for a user: 用户有三种可能的状态:

  • the user is logged into Facebook and has authenticated your application (connected) 用户已登录Facebook并已验证您的应用程序 (已连接)
  • the user is logged into Facebook but has not authenticated your application (not_authorized) 用户已登录Facebook,但尚未验证您的应用程序未授权
  • the user is not logged into Facebook at this time and so we don't know if they've authenticated your application or not (unknown) 用户目前尚未登录Facebook ,因此我们不知道他们是否通过了您的应用程序身份验证(未知)

With social application, knowing which of the these three states the user is in is one of the first things your application needs to know upon page load. 对于社交应用程序,了解用户处于这三种状态中的哪一种是您的应用程序在页面加载时需要知道的第一件事。

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

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