问题
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.
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.
How can I do it?
回答1:
This option is not available through the OAuth URL. I was using Facebook SDK for PHP and the solution is to use it in conjunction with the Facebook SDK for javascript:
FB.getLoginStatus
allows you to determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
- the user is logged into Facebook and has authenticated your application (connected)
- the user is logged into Facebook but has not authenticated your application (not_authorized)
- 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)
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.
来源:https://stackoverflow.com/questions/21425235/facebook-check-user-authorization-to-app-without-prompt