Fatal error: Uncaught OAuthException: An unexpected error has occurred. Please retry your request later.
I am trying give an option to Change their facebook cover from my website using facebook api.
Here is my code:
<script>
FB.login(function(response) {
if (response.authResponse) {
if (response)
{
fblogin();
// user is logged in and granted some permissions.
}
else
{
// user is logged in, but did not grant any permissions
alert('Kindly allow the My App to access the Facebook Account');
}
} else {
// user is not logged in
alert('You are not logged in Facebook Account');
}
}, {scope:'read_stream,publish_stream,publish_actions,offline_access,email'});
function fblogin()
{
var imageName = 'myimage.png';
jQuery.post("/facebook/index", {imageName:imageName}, function(data){
if(data)
{
parent.window.open("http://www.facebook.com/profile.php?preview_cover="+data,'_blank');
} else {
alert('Please Login.');
}
});
}
</script>
After login when i posted image name then :
require_once('/api/facebook/src/facebook.php');
$this->objfacebook = new Facebook(array(
'appId' => FB_APP_ID,
'secret' => FB_SECRET_KEY,
'fileUpload' => true,
'cookie' => true
));
$user_id = $this->objfacebook->getUser();
$access_token = $this->objfacebook->getAccessToken();
if ($user_id) {
$this->objfacebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message'=> 'Cover Photo',
'name'=> 'Created on My App'
);
$create_album = $this->objfacebook->api('/me/albums', 'post', $album_details);
$album_uid = $create_album['id'];
//Uploading Photo
$photo_details = array(
'message'=> 'Cover Photo',
'name'=> 'Created on My App'
);
$file = BASE_PATH."/public/images/".$_POST['imageName']; //BASE_PATH - Actual path of image
$photo_details['image'] = '#' . realpath($file);
$upload_photo = $this->objfacebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
echo $upload_photo['id'];
exit();
}
For my old user it is working fine, they have no issue when they changed their Facebook cover.
But when users come with their new facebook account to change their facebook they get a fetal error everytime.
I also have tried this with my new facebook account, it also gives me same Fetal Error.
I have no idea why is this happening for new users? Am i doing anything wrong here?
please give some idea.
it was happening because user didn't get any authorization popup to allow my app to publish data on their account..
it is fixed now. i have just updated my fb api. it works fine.
Related
I am creating a code to create instant articles on facebook using PHP SDK. I have created a login using it, and added 'public_profile,email,manage_pages,pages_show_list,pages_manage_instant_articles' permissions.
When user click on login button, it is asking for all these permissions. If user is an admin of a page and he logs in using it, he is able to create instant article on that page. But when user having an editor role of that page, tries to login, he is being asked for all these permissions, and even if he allows for all these permissions, still he is not able to create an instant article. In error log, there is a error like below:
PHP Fatal error: Uncaught Facebook\Exceptions\FacebookAuthorizationException: (#200) Requires extended permission: pages_manage_instant_articles in ../facebook-php-sdk-v4-5.0.0/src/Facebook/Exceptions/FacebookResponseException.php:120
At first time of login, editor user was asked for all permissions and he approved all, but still this error occurred. Now when he tries to again login, he is not being asked for permissions. I have checked permissions for editor role user though "/me/permissions" endpoint. In response, "email, user_friends, pages_show_list, and public_profile" permissions have status "granted", but there is no any detail about "manage_pages and pages_manage_instant_articles" permissions.
For admin role users, all code is working fine and instant article also created using PHP SDK, but this issue comes only for editor role user.
Here is code which I have tried, I have not included my app-id, app-secret, page-id and article-html here:
<?php
session_start();
$page_id = '{page-id}';
$app_id='{app-id}';
$app_secret='{app-secret}';
require_once 'testing/facebook-php-sdk-v4-5.0.0/src/Facebook/autoload.php';
if(!isset($_GET['user'])){
?>
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<script>
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {
// Logged into your app and Facebook.
//testAPI();
var accessToken = response.authResponse.accessToken;
console.log('access token -: '+accessToken);
location.href="instant_article.php?user=logged_in";
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
document.getElementById('status').innerHTML = 'Please log ' +
'into Facebook.';
}
}
// This function is called when someone finishes with the Login
// Button. See the onlogin handler attached to it in the sample
// code below.
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
window.fbAsyncInit = function() {
FB.init({
appId : <?= $app_id ?>,
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse social plugins on this page
version : 'v2.6' // use graph api version 2.5
});
// Now that we've initialized the JavaScript SDK, we call
// FB.getLoginStatus(). This function gets the state of the
// person visiting this page and can return one of three states to
// the callback you provide. They can be:
//
// 1. Logged into your app ('connected')
// 2. Logged into Facebook, but not your app ('not_authorized')
// 3. Not logged into Facebook and can't tell if they are logged into
// your app or not.
//
// These three cases are handled in the callback function.
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
// Load the SDK asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!--
Below we include the Login Button social plugin. This button uses
the JavaScript SDK to present a graphical Login button that triggers
the FB.login() function when clicked.
-->
<fb:login-button scope="public_profile,email,manage_pages,pages_show_list,pages_manage_instant_articles" onlogin="checkLoginState();">
</fb:login-button>
<div id="status">
</div>
</body>
</html>
<?php
}else{
$fb = new Facebook\Facebook([
'app_id' => $app_id,
'app_secret' => $app_secret,
'default_graph_version' => 'v2.6',
'default_access_token' => $app_id.'|'.$app_secret
]);
$oAuth2Client = $fb->getOAuth2Client();
$helper = $fb->getJavaScriptHelper();
$sr = $helper->getSignedRequest();
$user_id = $sr ? $sr->getUserId() : null;
if ( $user_id ) {
try {
// Get the access token
$accessToken = $helper->getAccessToken();
$_SESSION['user_token'] = (string) $accessToken;
} catch( Facebook\Exceptions\FacebookSDKException $e ) {
// There was an error communicating with Graph
echo "SDK error: ".$e->getMessage();
unset($_SESSION['user_token']);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
unset($_SESSION['user_token']);
}
if (! isset($accessToken)) {
echo 'No cookie set or no OAuth data could be obtained from cookie.';
unset($_SESSION['user_token']);
}else{
if($accessToken->isExpired()){
unset($_SESSION['user_token']);
echo "<script>location.href='instant_article.php'</script>";
exit;
}
}
if(!isset($_SESSION['user_token'])){
echo "<script>location.href='instant_article.php'</script>";
exit;
}
try {
// Exchanges a short-lived access token for a long-lived one
$userToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
$long_token = $userToken->getValue();
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// There was an error communicating with Graph
echo 'SDK error: '.$e->getMessage();
exit;
}
/*$res_perms = $fb->get('/me/permissions?access_token='.$long_token,$long_token,'','v2.6');
echo "<pre>";
print_r($res_perms);
exit;*/
$res_page = $fb->get('/'.$page_id.'?fields=access_token',$long_token,'','v2.6');
$page_info = $res_page->getDecodedBody();
$page_token = $page_info['access_token'];
$article_html = '{ html of article goes here}';
if(trim($article_html) != ""){
$page_params = array(
'access_token'=>$page_token,
'html_source'=>$article_html,
'development_mode'=>true
);
$res_article = $fb->post('/'.$page_id.'/instant_articles',$page_params,$page_token);
}
}
}
?>
It would be great if anyone can help me for this.
I'm currently developing my first facebook application. I have a problem with the setExtendedAccessToken() function in combination with FB.Event.subscribe('auth.login').
My js-code looks like this:
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'XXX', // App ID from the App Dashboard
channelUrl : 'http://domain.tld/app/channel.php', // Channel File for x-domain communication
frictionlessRequests: true,
cookie: true,
xfbml: true
});
FB.Event.subscribe('auth.login', function(response) {
$('#loginSpinner').show();
$('#loginFacebook').hide();
window.location = "http://domain.tld/app/?first_login";
});
};
The auth.login event should only trigger on the first login of the user.
This PHP Codes should also only trigger on the first login:
// triggers on first login
if (isset($_GET['first_login'])) {
if ($me) {
$facebook->setExtendedAccessToken();
$friends = $facebook->api('/me/friends');
$friends = $friends['data'];
if (!empty($friends)) {
//sql
}
$permissions = $facebook->api("/me/permissions");
if( array_key_exists('publish_actions', $permissions['data'][0]) ) {
$attachment = array(
'message' => 'XXX',
'name' => 'XXX - App',
'link' => 'http://domain.tld/app/',
'description' => 'XXX',
'picture'=> 'http://domain.tld/app/img.jpg',
'access_token' => $facebook->getAccessToken()
);
$facebook->api('/me/feed', 'POST', $attachment);
//sql
}
}
header('Location: http://domain.tld/app/');
exit;
}
The problem is an infinite loop which will always call the auth.login, because setExtendedAccessToken() will destroy the current session and facebook will login the user to my app automatically.
Is there a way to trigger auth.login only once? When I set setExtendedAccessToken() as a comment
// $facebook->setExtendedAccessToken();
my site only redirects the users once as it should be. But I need the extended login for my app.
My previous question: My WebApp (using facebook login) logs me out
I use Facebook PHP SDK 3.0.1 (latest currently).
What I need to be able to do is to post as a the identity of the Page on the Page.
I tried replacing the access_token with the access_token I get from the page (/me/accounts) however it now says token is invalid for some reason.
Facebook "impersonation" pages are offline now, and I don't see any info in the API regarding doing what I want.. maybe I'm lost or maybe not looking in the right direction..
Here's the example.php that I modified and use to archive this:
require '../src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
));
// Get User ID
$user = $facebook->getUser();
//Lists all the applications and pages
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$accounts_list = $facebook->api('/me/accounts');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
$page_selected = 'xxxxxxxxxxxx';
$page_access_token = $accounts_list['data']['0']['access_token'];
echo 'page_access_token:' . $page_access_token;
<?php
if (isset($_GET['publish'])){
try {
$publishStream = $facebook->api("/$page_selected/feed", 'post', array(
'access_token' => '$page_access_token',
'message' => 'Development Test message',
'link' => 'http://xxxxxxx.com',
'picture' => 'http://xxxxxx/xxxx_logo.gif',
'name' => 'xxxxxxxx Goes Here',
'description'=> 'And the exciting description here!'
)
);
//as $_GET['publish'] is set so remove it by redirecting user to the base url
} catch (FacebookApiException $e) {
echo($e);
echo $publishStream;
echo 'catch goes here';
}
}
?>
Since I can't answer my own question I edited the question.
Went through the whole API..
Solution:
Before posting as the page you need to set your access_token to the one page owns.
$facebook->setAccessToken($page_access_token);
does just that, and afterwards everything goes as it normally would be expected, no need to modify post function and add "access_token" option to post.
1.First you have to get the page access token.
public function getPageToken()
{
$page_id = "xxxxxxxxxx";
$page_access_token = "";
$result = $this->facebook->api("/me/accounts");
if( !empty($result['data']) )
{
foreach($result["data"] as $page)
{
if($page["id"] == $page_id)
{
$page_access_token = $page["access_token"];
break;
}
}
}
else
{
$url = "https://www.facebook.com/dialog/oauth?client_id=xxxxxxxxxx&redirect_uri=http://apps.facebook.com/xxxxxx&scope=manage_pages&response_type=token";
echo "<script type='text/javascript'> top.location.href='".$url."'; </script>";
}
return $page_access_token;
}
2.After getting the page access token just include that token in your post to wall code.
<script src="//connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
var token = '<?php echo $page_access_token ?>';
var wallPost = {
access_token: token,
message : 'xxxxxxxx',
link : 'http://apps.facebook.com/xxxxxxx/',
picture : 'xxxxxxxx',
name : 'xxxxx',
caption : 'xxxxxx',
description : 'xxxxxxx',
};
FB.api('/pageid/feed', 'post', wallPost, function(response) {
if (!response || response.error) {
} else {
}
});
</script>
3.Remember this code will only publish your post on Fan page's wall and users who liked the fan page will be able to see that post as the post is posted on their own feed.
Hope this will solve your problem.
I created a facebook application and send request to a user through below code.Now when a user allow my application then i need his id and email address into my canvas url.But on that below code user don't go to my canvas URL.So,Please help me to solve ,how a user go to my canvas url when he allow my application and i get the user id of that user?My code is below:
require_once 'facebook.php';
$facebook = new Facebook(array(
'appId' => '#######',
'secret' => '###################',
'cookie' => true, ));
$req_perms = "publish_stream,offline_access,user_status,email,read_stream";
$session = $facebook->getSession();
$loginUrl = $facebook->getLoginUrl(array('canvas'=>1,'fbconnect' => 0,'req_perms'=>$req_perms));
$me = null;
if (!$session)
{ echo "top.location.href= '$loginUrl';";exit;}
else{
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
}
catch (FacebookApiException $e)
{ echo "<script type='text/javascript'>top.location.href= '$loginUrl';</script>"; exit;}
}
So,please help me to get the user id.
Thanks in advance
riad
The Facebook ID & email for the current user can be accessed through:
$me['id'];
$me['email'];
Is that what you're after?
First of all, your code is "badly" written. The catch block in your code "when executed" does not mean that the user is not logged in. It means that something went wrong in your try block (a.k.a bad Facebook Call).
Now for your question, you just need to place this in your try block:
$data = $facebook->api('/me?fields=id,email');
IMPORTANT NOTE:
You may not get the user real email, the user may choose to not share it with you and this way Facebook will create a "mirror" email to share with your App.
I am not familiar with php to comment on the code above. However in general it would be better to use javascript sdk for login alone (faced the same issue in asp.net). That way post user login, the control comes back to the same page where it was initiated. For example:
<div id="fb-root"></div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId: <app_id>, cookie: true, status: true, xfbml: true
});
function fblogin() {
FB.login(function (response) {
//Control comes back here
if (response.session) {
alert(response.session.access_token);
var url = '/me?fields=name,email';
FB.api(url, function (response) {
//You are now in the same page with the data you wanted. If necessary redirect.
alert(response.name);
alert(response.email);
});
}
else {
alert("User did not login successfully");
}
}, { perms: 'email' });
}
</script>
<img src="../Images/social_facebook.png" />
At last i solve my problem and now i can easily get the facebook user id and email address and other related information.Using this code i can hit to facebook for particular user's authentication and when user accept my application then i can get his/her facebook user id, email and other information into $user_info array.Hope it will help you.
Just see my code below:
<?php
require_once 'facebook.php';
$facebook = new Facebook(array(
'appId' => '########',
'secret' => '##########################',
'cookie' => true,
));
$req_perms = "publish_stream,offline_access,user_status,email,read_stream";
$session = $facebook->getSession();
$loginUrl = $facebook->getLoginUrl(array('canvas'=> 1,'fbconnect' => 0,'req_perms' => $req_perms));
$user_info = null;
if (!$session)
{ echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";exit;}
else{
try { $user_info = $facebook->api('/me'); }
catch (FacebookApiException $e)
{ echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>"; exit;}
}
?>
<!doctype html>
<html>
<head>
</head>
<body>
<?php
$user_name=$user_info['name'];
echo "Hi $user_name ! Your Facebook ID is: ".$user_info['id']."<br/>";
echo "Hi $user_name ! Your E-mail Address is: ".$user_info['email']."<br/>";
echo "Thanks for accepting our application.";
//print_r($user_info);
?>
</body>
</html>
I'm using the Graph API, but I can't figure out how to get a logged-in users email address.
The intro to Graph states "The Graph API can provide access to all of the basic account registration data you would typically request in a sign-up form for your site, including name, email address, profile picture, and birthday"
All well and good, but how do I access that info?
This is what I have so far:
$json = $facebook->api('/me');
$first = $json['first_name']; // gets first name
$last = $json['last_name'];
The only way to get the users e-mail address is to request extended permissions on the email field. The user must allow you to see this and you cannot get the e-mail addresses of the user's friends.
http://developers.facebook.com/docs/authentication/permissions
You can do this if you are using Facebook connect by passing scope=email in the get string of your call to the Auth Dialog.
I'd recommend using an SDK instead of file_get_contents as it makes it far easier to perform the Oauth authentication.
// Facebook SDK v5 for PHP
// https://developers.facebook.com/docs/php/gettingstarted/5.0.0
$fb = new Facebook\Facebook([
'app_id' => '{app-id}',
'app_secret' => '{app-secret}',
'default_graph_version' => 'v2.4',
]);
$fb->setDefaultAccessToken($_SESSION['facebook_access_token']);
$response = $fb->get('/me?locale=en_US&fields=name,email');
$userNode = $response->getGraphUser();
var_dump(
$userNode->getField('email'), $userNode['email']
);
Open base_facebook.php
Add Access_token at function getLoginUrl()
array_merge(array(
'access_token' => $this->getAccessToken(),
'client_id' => $this->getAppId(),
'redirect_uri' => $currentUrl, // possibly overwritten
'state' => $this->state),
$params);
and Use scope for Email Permission
if ($user) {
echo $logoutUrl = $facebook->getLogoutUrl();
} else {
echo $loginUrl = $facebook->getLoginUrl(array('scope' => 'email,read_stream'));
}
Just add these code block on status return, and start passing a query string object {}. For JavaScript devs
After initializing your sdk.
step 1: // get login status
$(document).ready(function($) {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
console.log(response);
});
});
This will check on document load and get your login status check if users has been logged in.
Then the function checkLoginState is called, and response is pass to statusChangeCallback
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
Step 2: Let you get the response data from the status
function statusChangeCallback(response) {
// body...
if(response.status === 'connected'){
// setElements(true);
let userId = response.authResponse.userID;
// console.log(userId);
console.log('login');
getUserInfo(userId);
}else{
// setElements(false);
console.log('not logged in !');
}
}
This also has the userid which is being set to variable, then a getUserInfo func is called to fetch user information using the Graph-api.
function getUserInfo(userId) {
// body...
FB.api(
'/'+userId+'/?fields=id,name,email',
'GET',
{},
function(response) {
// Insert your code here
// console.log(response);
let email = response.email;
loginViaEmail(email);
}
);
}
After passing the userid as an argument, the function then fetch all information relating to that userid. Note: in my case i was looking for the email, as to allowed me run a function that can logged user via email only.
// login via email
function loginViaEmail(email) {
// body...
let token = '{{ csrf_token() }}';
let data = {
_token:token,
email:email
}
$.ajax({
url: '/login/via/email',
type: 'POST',
dataType: 'json',
data: data,
success: function(data){
console.log(data);
if(data.status == 'success'){
window.location.href = '/dashboard';
}
if(data.status == 'info'){
window.location.href = '/create-account';
}
},
error: function(data){
console.log('Error logging in via email !');
// alert('Fail to send login request !');
}
});
}
To get the user email, you have to log in the user with his Facebook account using the email permission. Use for that the Facebook PHP SDK (see on github) as following.
First check if the user is already logged in :
require "facebook.php";
$facebook = new Facebook(array(
'appId' => YOUR_APP_ID,
'secret' => YOUR_APP_SECRET,
));
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
$user = null;
}
}
If he his not, you can display the login link asking for the email permission :
if (!$user) {
$args = array('scope' => 'email');
echo 'Login with Facebook';
} else {
echo 'Logout';
}
When he is logged in the email can be found in the $user_profile array.
Hope that helps !
Assuming you've requested email permissions when the user logged in from your app and you have a valid token,
With the fetch api you can just
const token = "some_valid_token";
const response = await fetch(
`https://graph.facebook.com/me?fields=email&access_token=${token}`
);
const result = await response.json();
result will be:
{
"id": "some_id",
"email": "name#example.org"
}
id will be returned anyway.
You can add to the fields query param more stuff, but you need permissions for them if they are not on the public profile (name is public).
?fields=name,email,user_birthday&token=
https://developers.facebook.com/docs/facebook-login/permissions
You can retrieve the email address from the logged in user's profile. Here is the code snippet
<?php
$facebook = new Facebook(array(
'appId' => $initMe["appId"],
'secret' => $initMe["appSecret"],
));
$facebook->setAccessToken($initMe["accessToken"]);
$user = $facebook->getUser();
if ($user) {
$user_profile = $facebook->api('/me');
print_r($user_profile["email"]);
}
?>
First, activate your application at the Facebook Developer center. Applications in development mode are not allowed to retrieve the e-mail field.
If the user is not logged in, you need to login and specify that your application/site will need the e-mail field.
FB.login(
function(response) {
console.log('Welcome!');
},
{scope: 'email'}
);
Then, after the login, or if the user is already logged, retrieve the e-mail using the Facebook API, specifying the field email:
FB.api('/me', {fields: 'name,email'}, (response) => {
console.log(response.name + ', ' + response.email);
console.log('full response: ', response);
});
https://graph.facebook.com/me
will give you info about the currently logged-in user, but you'll need to supply an oauth token. See:
http://developers.facebook.com/docs/reference/api/user
The email in the profile can be obtained using extended permission but I Guess it's not possible to get the email used to login fb. In my app i wanted to display mulitple fb accounts of a user in a list, i wanted to show the login emails of fb accounts as a unique identifier of the respective accounts but i couldn't get it off from fb, all i got was the primary email in the user profile but in my case my login email and my primary email are different.
Make sure your Facebook application is published. In order to receive data for email, public_profile and user_friends your app must be made available to public.
You can disable it later for development purposes and still get email field.
The following tools can be useful during development:
Access Token Debugger: Paste in an access token for details
https://developers.facebook.com/tools/debug/accesstoken/
Graph API Explorer: Test requests to the graph api after pasting in your access token
https://developers.facebook.com/tools/explorer
Make sure to fully specify the version number of the API as something like "v2.11" and not "2.11"
I'm not sure what it defaults to if this is incorrect, but I got some odd errors trying to just retrieve the email when I missed the v.
For me the problem with collecting user's email addres on PHP side (getGraphUser() method) was, that the default behavior of facebook-rendered button (on WEBSIDE side, created with xfbml=1) is to implicity calling FB.login() with the scope NOT including "email".
That means you MUST:
1) call
FB.login(....,{scope: email})
manifestly, creating your own button to start login process
OR
2) add scope="email" attribute to the xfbml button
<div class="fb-login-button" data-size="large" data-button-type="continue_with" data-
layout="rounded" data-auto-logout-link="false" data-use-continue-as="true" data-
width="1000px" scope="email"></div>
to be able to collect email address on PHP side.
Hope it helps.