I've implemented system wide with JWT. Everything is working great except a key point, the expiration method.
Map<String, Object> header = new HashMap<>();
header.put("typ", Header.JWT_TYPE);
String compactJws = Jwts.builder()
.setHeader(header)
.claim("email", email)
.claim("password", password)
.setIssuedAt(new Date(System.currentTimeMillis()))
.setExpiration(new Date(System.currentTimeMillis() + 3600000))
.signWith(SignatureAlgorithm.HS256, settings.getString("keychain", "password"))
.compact();
Request request = new Request.Builder()
.url(SITE_URL + "secure.php")
.post(new FormBody.Builder().add("data", compactJws).build())
.tag("login")
.build();
okClient.newCall(request).enqueue(this);
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6Imd1eSIsInBhc3N3b3JkIjoiZ3V5IiwiaWF0IjoxNDk3NTU0MzAzLCJleHAiOjE0OTc1NTc5MDN9.4GFSC_OCYzkCxGetTFKKxoUkbpxWi51ccoKtIpPjz6g
<?php
$jwt = $_POST['data'];
require_once 'jwt/src/BeforeValidException.php';
require_once 'jwt/src/ExpiredException.php';
require_once 'jwt/src/SignatureInvalidException.php';
require_once 'jwt/src/JWT.php';
use \Firebase\JWT\JWT;
try {
$decoded_array = (array) JWT::decode($jwt, base64_decode("password"), array('HS256'));
}
catch (SignatureInvalidException $e) {
echo json_encode(array('user_id' => - 3, 'title' => 'Contact 3gcb19#gmail.com', 'msg' => 'SignatureInvalidException'));
exit(0);
}
catch (ExpiredException $e) {
echo json_encode(array('user_id' => - 3, 'title' => 'Contact 3gcb19#gmail.com', 'msg' => 'ExpiredException'));
exit(0);
}
catch (UnexpectedValueException $e) {
echo json_encode(array('user_id' => - 3, 'title' => 'Contact 3gcb19#gmail.com', 'msg' => 'UnexpectedValueException'));
exit(0);
}
$email = $decoded_array['email'];
$password = $decoded_array['password'];
Always throws an UnexpectedValueException
Remove the timestamps and it works fine on the php end
.setIssuedAt(new Date(System.currentTimeMillis()))
.setExpiration(new Date(System.currentTimeMillis() + 3600000))
What am I missing here??
Related
I have created an event on my test page and I'm going to upload a video to that event page from my web site. I have used the below code but it is doesn't work.
$data = [
'title' => 'test Video',
'description' => 'This is test video',
'source' => $fb->videoToUpload($video_path),
];
try {
$response = $fb->post('/' . $event_id . '/videos', $data, $page_token);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
return 'Graph returned an error: ' . $e->getMessage();
} catch(Facebook\Exceptions\FacebookSDKException $e){
return 'Facebook SDK returned an error: ' . $e->getMessage();
}
$graphNode = $response->getGraphNode();
I got this error.
Graph returned an error:(#33) This object does not exist or does not support this action.
So I fix some parts like this.
$data = [
.......
'source' => $video_path
];
try{
$response = $fb->post('/' . $event_id . '/feed', $data, $page_token);
}
.......
Then it works like this.
But I want to result like as this picture.
How shall I do?
Official reference for post video on event (Api Graph v5.0):
Upload:
$fb = new Facebook\Facebook([
'app_id' => '{app-id}',
'app_secret' => '{app-secret}',
'default_graph_version' => 'v2.2',
]);
$data = [
'title' => 'My Foo Video',
'description' => 'This video is full of foo and bar action.',
'source' => $fb->videoToUpload('/path/to/foo_bar.mp4'),
];
try {
$response = $fb->post('/me/videos', $data, 'user-access-token');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
var_dump($graphNode);
echo 'Video ID: ' . $graphNode['id'];
POST ON EVENT:
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{event-id}/videos',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
If you see the result JSON :
{
"data": [],
"paging": {}
}
All reference:
-Start - Initialize an upload session
-Transfer - Upload video chunks
-Finish - Post the video
In the function:
private function postFBVideo($authResponse, $fileObj, $formData)
{
FacebookSession::setDefaultApplication('yourAppkey', 'yourAppSecret');
$ajaxResponse = '';
try {
$session = new FacebookSession($authResponse->accessToken);
} catch (FacebookRequestException $ex) {
// When Facebook returns an error
$ajaxResponse = 'FB Error ->' . json_encode($ex) ;
} catch (\Exception $ex) {
// When validation fails or other local issues
$ajaxResponse = 'FB Validation Error - ' . json_encode($ex) ;
}
if ($session) {
$response = (new FacebookRequest(
$session, 'POST', '/.$idevent./videos', array(
'source' => new CURLFile('path', 'video/MOV'),
'message' => $formDataMessage,
)
))->execute();
$ajaxResponse = $response->getGraphObject();
}
return json_encode($ajaxResponse);
}
I have a function that generates a JWT :
function getToken($user, $expTime){
$jwt = \Firebase\JWT\JWT::encode([
'iss' => request()->getBaseUrl(),
'sub' => "{$user['id']}",
'exp' => $expTime,
'iat' => time(),
'nbf' => time(),
'is_admin' => $user['role_id'] == 1
], getenv("SECRET_KEY"), 'HS256');
return $jwt;
}
This function returns the below token:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJcL2FwaSIsInN1YiI6InVzNWIzY2M4YmRlMDc4MSIsImV4cCI6NTUxMDY1ODkyNDAwMCwiaWF0IjoxNTMwNzM4NTkwLCJuYmYiOjE1MzA3Mzg1OTAsImlzX2FkbWluIjpmYWxzZX0.3bMaxCaMprURZEDurnckZWSoDRp7ePMxZXDW0B6q6fk
When I use this token to make a request I get that:
{
"status": "error",
"message": "Signature verification failed"
}
To make it work I go to https://jwt.io/, add the key and verify it by passing the secret.
Then I get this token :
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIvYXBpIiwic3ViIjoidXM1YjNjYzhiZGUwNzgxIiwiZXhwIjo1NTEwNjU4OTI0MDAwLCJpYXQiOjE1MzA3Mzg1OTAsIm5iZiI6MTUzMDczODU5MCwiaXNfYWRtaW4iOmZhbHNlfQ.heF_L9LrFp7Hht2dbVtOMx_gdUtmPKzrMgxW1_jdWLo
And this works fine. But how to verify it with php code so I can send it to the user?
Code for response:
function loginUser($email, $password) {
try {
// Connecting to databas
$db = new db();
$db = $db->connect();
$user = findUserByEmail($email, $db);
if(empty($user)){
echo 'User not found';
exit;
}
if(!password_verify($password, $user['password'])) {
echo 'Password does not match';
exit;
}
$expTime = time() * 3600;
$jwt = getToken($user, $expTime);
// Close databse
$db = null;
} catch(PDOException $e){
echo $e->getMessage();
}
return $jwt;
}
If you're landing on this page because of a "Signature verification failed" Google search, here is one thing to consider. I was getting this error because there were two spaces between "Bearer" and my token in the Authorization header.
Wrong:
Authorization:Bearer eyJraWQiOiJDT2N...
Correct:
Authorization:Bearer eyJraWQiOiJDT2N...
Ok finally I made it work by changing a little the function that generates the token:
function getToken($user, $expTime){
$key = "secretkey";
$token = array(
'iss' => request()->getBaseUrl(),
'sub' => "{$user['id']}",
'exp' => $expTime,
'iat' => time(),
'nbf' => time(),
'is_admin' => $user['role_id'] == 1
);
return JWT::encode($token, $key);
}
I need help. i have a group of photos ususally selected from the database. I loop around an array say $piclinks then look around it to post the pictures. But i need it to display as one post as shown in the image.
Those any one have an idea what i can do
<?php
define('FACEBOOK_SDK_V4_SRC_DIR', __DIR__.'/src/Facebook/');
require_once(__DIR__.'/src/Facebook/autoload.php');
$fb = new Facebook\Facebook([
'app_id' => '2082153322064454',
'app_secret' => '7355d8111164630537a35b43a1bbd336',
'default_graph_version' => 'v2.2',
]);
$piclinks = array("http://d24w6bsrhbeh9d.cloudfront.net/photo/agydwb6_460s.jpg", "https://greenparrotnews.com/wp-content/uploads/2017/10/Boss-Mustapha.jpg");
foreach($piclinks as $selectedlink){
//Post property to Facebook
$linkData = [
'message' => 'Your message here',
'url' => $selectedlink
];
$pageAccessToken ='EAAdltRkhKkYBAHbLBwoKDZBSat5ulIJZBbMz4gZBQSZCZCY7oH7vRgN16QBuYZBZAjSzZCvt04ypoRaTG4o5jdhXA9bjIV8ZB0ZAJ8lsVNZBxYRInwn7tc8ZBsmdhxKZBnmHCA0n3k3wOOlQRcpDPQyXa1RZBoSb3ZAasDhHHxQfTeRdPObE68OZAAxMoaDcs';
try {
$response = $fb->post('/me/photos', $linkData, $pageAccessToken);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: '.$e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: '.$e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
echo 'done';
}
?>
You have to upload your photos first, then you will get photo id. After that you have to create post with all photo ids. It may be helpful for you. Example code:
$images = []; // say your all images is in array.
foreach($images as $image){
try {
$response = $fb->post("/PAGEID/photos", [
'source' => $fb->fileToUpload($image),
'published' => 'false'
], PAGE_TOKEN);
} catch(Facebook\Exceptions\FacebookSDKException $e) {
$errors[]= 'Error: ' . $e->getMessage();
}
$graphNode = $response->getGraphNode();
$post_images[]= $graphNode['id'];
}
foreach ($post_images as $key => $post_image) {
$attachMedia[$key] = ['media_fbid' => $post_image];
}
try {
$response = $fb->post(
"/PAGEID/feed",
[
'message' => YOUR_MESSAGE,
'attached_media' => $attachMedia
],
PAGE_TOKEN
);
} catch(Facebook\Exceptions\FacebookSDKException $e) {
$errors[]= 'Error: ' . $e->getMessage();
}
$post = json_decode($response->getBody());
When trying to create an event on YouTube using YouTube Data API I get following error only in case of very few users:
Fatal error: Uncaught exception 'Google_Service_Exception' with message 'Error calling POST https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet%2Cstatus: (403) The user is not enabled for live streaming.' in E:\Rupesh\Websites\abtv\abstream\Google\Http\REST.php on line 110
Please also note following :
The user id is of the form xyz#gmail.com only. I know for fact, this code does not work for user id of the form xyz##pages.plusgoogle.com.
User is authenticated using Google's OAuth 2 prior to calling this function.
User has allowed access to Web Application using #gmail.com id.
Following is class I have put together:
set_include_path(get_include_path() . PATH_SEPARATOR . '/home/aprilbr3/public_html/google-api-php-client/src');
require_once 'Google/autoload.php';
require_once 'Google/Client.php';
require_once 'Google/Service/Oauth2.php';
require_once 'class.miscellaneous_functions.php';
class GoogleClient
{
public static $cdn_formats = array(
"Poor" => "240p", "Ok" => "360p", "Good" => "480p", "Better" => "720p", "Best" => "1080p");
public static $privacy_statuses = array(
"public" => "public", "unlisted" => "unlisted", "private" => "private");
private static $OAUTH2_CLIENT_ID = 'CLIENT_ID_HERE';
private static $OAUTH2_CLIENT_SECRET = 'CLIENT_SECRET_HERE';
private static $privacy_status = "public"; // $privacy_statuses["public"];
//private static $cdn_format = $cdn_formats["Ok"];
private static $cdn_injestion_type = "rtmp";
var $client;
var $plus;
var $redirect_url;
var $user_info;
function __construct()
{
$this->client = new Google_Client();
$this->client->setClientId(GoogleClient::$OAUTH2_CLIENT_ID);
$this->client->setClientSecret(GoogleClient::$OAUTH2_CLIENT_SECRET);
$redirect_url = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'],
FILTER_SANITIZE_URL);
$this->client->setRedirectUri($redirect_url);
$this->client->setScopes(array(
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/youtube'));
$this->plus = new Google_Service_Oauth2($this->client);
} // __construct()
function OAuth2()
{
if (!isset($_SESSION))
session_start();
if (isset($_REQUEST['logout'])) {
unset($_SESSION['access_token']);
}
if (isset($_GET['code'])) {
try {
$this->client->authenticate($_GET['code']);
} catch (Google_Auth_Exception $e) {
MiscellaneousFunctions::DestroySessionAndRedirectTo($this->redirect_url);
}
$_SESSION['access_token'] = $this->client->getAccessToken();
header('Location:' . $this->redirect_url);
}
if (isset($_SESSION['access_token'])) {
$this->client->setAccessToken($_SESSION['access_token']);
}
$error = false;
if (!$this->client->getAccessToken()) {
$error = true;
}
if (!$error) {
try {
$user_info = $this->plus->userinfo->get();
return array('result' => true, 'user_info' => $user_info);
} catch (Google_Service_Exception $e) {
MiscellaneousFunctions::DestroySessionAndRedirectTo($this->redirect_url);
//exit();
} catch (Google_Exception $e) {
MiscellaneousFunctions::DestroySessionAndRedirectTo($this->redirect_url);
//exit();
}
}
return array('result' => false, 'auth_url' => $this->client->createAuthUrl());
//MiscellaneousFunctions::DestroySessionAndRedirectTo($this->client->createAuthUrl());
//exit();
} // OAuth2
function CreateEvent($broadcast_title, $broadcast_description, $cdn_format,
$start_date_time, $end_date_time)
{
//echo( "Step 1" . "\n<br><br><br>");
$stream_title = "Stream for " . $broadcast_title;
$youtube = new Google_Service_YouTube($this->client);
try {
// Create an object for the liveBroadcast resource's snippet. Specify values
// for the snippet's title, scheduled start time, and scheduled end time.
$broadcastSnippet = new Google_Service_YouTube_LiveBroadcastSnippet();
$broadcastSnippet->setTitle($broadcast_title);
//echo( "Step 2" . "\n<br><br><br>");
//echo( "Start Time : " . MiscellaneousFunctions::GetDateTimeStringForYoutube($start_date_time) . "\n</br>");
//echo( "End Time : " . MiscellaneousFunctions::GetDateTimeStringForYoutube($end_date_time) . "\n</br>");
//exit;
$broadcastSnippet->setScheduledStartTime(
MiscellaneousFunctions::GetDateTimeStringForYoutube($start_date_time));
$broadcastSnippet->setScheduledEndTime(
MiscellaneousFunctions::GetDateTimeStringForYoutube($end_date_time));
$broadcastSnippet->setDescription($broadcast_description);
//echo( "Step 3" . "\n<br><br><br>");
// Create an object for the liveBroadcast resource's status, and set the
// broadcast's status to "private".
$status = new Google_Service_YouTube_LiveBroadcastStatus();
$status->setPrivacyStatus(GoogleClient::$privacy_status);
//echo( "Step 4" . "\n<br><br><br>");
// Create the API request that inserts the liveBroadcast resource.
$broadcastInsert = new Google_Service_YouTube_LiveBroadcast();
$broadcastInsert->setSnippet($broadcastSnippet);
$broadcastInsert->setStatus($status);
$broadcastInsert->setKind('youtube#liveBroadcast');
//echo( "Step 5" . "\n<br><br><br>");
//echo( json_encode( $youtube ) . "\n<br><br><br>");
// Execute the request and return an object that contains information
// about the new broadcast.
$broadcastsResponse = $youtube->liveBroadcasts->insert('snippet,status',
$broadcastInsert, array());
//echo( "Step 6" . "\n<br><br><br>");
// Create an object for the liveStream resource's snippet. Specify a value
// for the snippet's title.
$streamSnippet = new Google_Service_YouTube_LiveStreamSnippet();
$streamSnippet->setTitle($stream_title);
// echo( "Step 7" . "\n<br><br><br>");
// Create an object for content distribution network details for the live
// stream and specify the stream's format and ingestion type.
$cdn = new Google_Service_YouTube_CdnSettings();
$cdn->setFormat($cdn_format);
$cdn->setIngestionType(GoogleClient::$cdn_injestion_type);
// echo( "Step 8" . "\n<br><br><br>");
// Create the API request that inserts the liveStream resource.
$streamInsert = new Google_Service_YouTube_LiveStream();
$streamInsert->setSnippet($streamSnippet);
$streamInsert->setCdn($cdn);
$streamInsert->setKind('youtube#liveStream');
// echo( "Step 9" . "\n<br><br><br>");
// Execute the request and return an object that contains information
// about the new stream.
$streamsResponse = $youtube->liveStreams->insert('snippet,cdn', $streamInsert, array());
// Bind the broadcast to the live stream.
$bindBroadcastResponse = $youtube->liveBroadcasts->bind(
$broadcastsResponse['id'], 'id,contentDetails',
array('streamId' => $streamsResponse['id'],));
// echo( "Step 10" . "\n<br><br><br>");
return array('result' => true,
'broadcasts_response' => $broadcastsResponse,
//'broadcasts_response_id' => $broadcastsResponse['id'],
//'broadcasts_response_snippet' => $broadcastsResponse['snippet'],
'streams_response' => $streamsResponse
//'streams_response_id' => $streamsResponse['id'],
//'streams_response_snippet' => $streamsResponse['snippet'],
//'streams_response_cdn' => $streamsResponse['cdn'],
//'streams_response_cdn_ingestionInfo' => $streamsResponse['cdn']['ingestionInfo']
);
} catch (Google_Service_Exception $e) {
//MiscellaneousFunctions::DestroySessionAndRedirectTo($this->redirect_url);
$reason = json_encode($e->getMessage(), JSON_PRETTY_PRINT);
//echo( "Google_Service_Exception:" . json_encode( $e ) . "\n<br><br><br>");
// return array('result' => false, 'reason' => $reason);
} catch (Google_Exception $e) {
//MiscellaneousFunctions::DestroySessionAndRedirectTo($this->redirect_url);
$reason = json_encode($e->getMessage(), JSON_PRETTY_PRINT);
//echo( "Google_Exception:" . json_encode( $e ) . "\n<br><br><br>");
//return array('result' => false, 'reason' => $reason);
}
return array('result' => false, 'reason' => $reason);
}
function GetEvent( $broadcast_id )
{
$youtube = new Google_Service_YouTube($this->client);
try {
// Execute an API request that lists broadcasts owned by the user who
// authorized the request.
$broadcastsResponse = $youtube->liveBroadcasts->listLiveBroadcasts(
'id,snippet,contentDetails,status',
array( 'id' => $broadcast_id ));
$broadcastItem = $broadcastsResponse['items'][0];
$streamId = $broadcastItem['contentDetails']['boundStreamId'];
$streamsResponse = $youtube->liveStreams->listLiveStreams(
'id,snippet,cdn,status',
array( 'id' => $streamId ));
$streamItem = $streamsResponse['items'][0];
return array('result' => true,
'broadcasts_response' => $broadcastItem,
'streams_response' => $streamItem
);
} catch (Google_Service_Exception $e) {
$reason = json_encode($e->getMessage(), JSON_PRETTY_PRINT);
} catch (Google_Exception $e) {
$reason = json_encode($e->getMessage(), JSON_PRETTY_PRINT);
}
return array('result' => false, 'reason' => $reason);
}
} // class GoogleClient
Thank you.
Rupesh
P.S: Sorry, I forgot to mention that all the users of the system have enabled live streaming in their respective youtube accounts. That's what puzzles me!
I'd like to post on page - throught my site. . I didn't find anything that could help me in documentation. Also none of google results gave mi answer.
function post_facebook($data=null){
$result = "";
require_once (ROOT. "/apps/configuration/models/ConfigurationItem.php");
require_once (ROOT . "/components/facebook/facebook.php");
$this->ConfigurationItem = new ConfigurationItem($this->getContext());
$row=$this->ConfigurationItem->findByCatKeyItemKey('system','facebook_login');
$apiid=$row['value'];
$row=$this->ConfigurationItem->findByCatKeyItemKey('system','facebook_pass');
$secret=$row['value'];
$facebook = new Facebook(array(
'appId' => $apiid,
'secret' => $secret,
'cookie' => true,
));
$session = $facebook->getSession();
print_r($session);
$me = null;
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
$message=$data['facebook_text'];
$attachment = array(
'message' => $data['facebook_text'],
'name' => $data['name'],
'link' => $this->getLinkToLatestNews(),
'description' => '',
);
if($data['thumb_file_tree_id'] !== NULL) $attachment = $_SERVER['HTTP_HOST']."media/file/image_by_id/".$data['thumb_file_tree_id']."/?w=400&h=500";
try {
$facebook->api('/162618213751448/feed/', 'post', $attachment);
$result = "Facebook: Sent";
} catch (FacebookApiException $e) {
$result = "Facebook: Failed";
error_log($e);
}
} else {
$login_url = $facebook->getLoginUrl();
header("Location: ".$login_url);
exit;
}
return $result;
}
The wrong part is:
$session = $facebook->getSession();
$me = null;
if ($session) {
(...)
} else {
$login_url = $facebook->getLoginUrl();
header("Location: ".$login_url);
exit;
}
I want to allow user to login on specified FB account (this with page), and then send. App settings allow only this account to post, so it should be ok... But isn't. When I log out FB account, session still exists, but returns exception. What's wrong?
if you want to post on a fan page where you are adminstrator.. do the next
Your application needs to have this permission minimum:
$this->loginUrl = $this->facebook->getLoginUrl(
array(
'scope' => 'manage_pages,offline_access,publish_stream',
'redirect_uri' => $url,
)
);
After you are logged into:
//get pages or applications where you are administrator
$accounts = $this->facebook->api('/me/accounts');
//page where i want to post
$page_id = '227870047252297';
foreach($accounts['data'] as $account)
{
if($account['id'] == $page_id)
{
$token = $account['access_token'];
}
}
$attachment = array(
'access_token' => $token,
'message' => 'mensaje',
'name' => 'titulo',
'link' => 'http://...',
'description' => 'xxxxx',
'picture'=> 'http://...',
);
try{
$res = $this->facebook->api('/'.$page_id.'/feed','POST',$attachment);
} catch (Exception $e){
echo $e->getMessage();
}
If I understand this correctly, you want to send a message to the user's wall who's connected to your application via your website the moment they log in? If so, try this. Rework the script to prevent constant posting, but this model, in theory, should work.
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
// Place messaging portion here instead.
$message = $facebook->api('/me/feed', 'post', array(
'message'=> '<Message>',
'picture' => '<Picture URL>',
'link'=> '<URL>',
'description'=>'Description',
'name'=> '<Name of Post>',
'privacy'=> '<ALL_FRIENDS (Default)>',
'caption'=> '<Caption>',
)
);
} catch (FacebookApiException $e) {
error_log($e);
}
So if the user is connected with your application and the session is valid, it will automatically send the post to their news feed (Wall).