Facebook::getLoginUrl( $params=array() )This method returns a URL that, when clicked by the user on the client-side, will redirect the user to login to Facebook and authorize your application, if necessary. It will when then redirect back to your application. If the user did not successfully log in, or did not authorize your application, the user will be redirected via an HTTP 302 redirect to your redirect_uri with error, error_reason, and error_description parameters in the URL. See the authentication page for details.
$params = array(
'scope' => 'read_stream, friends_likes',
'redirect_uri' => 'https://www.myapp.com/post_login_page'
);
$loginUrl = $facebook->getLoginUrl($params);
This method takes an optional $params associative array containing key and value pairs normally used with the OAuth Dialog as described in the authentication documentation. Some common parameters are:
| Name | Description |
|---|---|
scope |
(optional) The permissions to request from the user. If this property is not specified, basic permissions will be requested from the user. |
redirect_uri |
(optional) The URL to redirect the user to once the login/authorization process is complete. The user will be redirected to the URL on both login success and failure, so you must check the error parameters in the URL as described in the authentication documentation. If this property is not specified, the user will be redirected to the current URL (i.e. the URL of the page where this method was called, typically the current URL in the user's browser). |
display |
(optional) The display mode in which to render the dialog. The default is page, but can be set to other values such as popup. |
If the $params array is not specified, or empty, basic permissions are requested, and the current URL is used as the redirect_uri.