当前位置: 首页>>代码示例>>PHP>>正文


PHP Facebook::getJavaScriptHelper方法代码示例

本文整理汇总了PHP中Facebook\Facebook::getJavaScriptHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::getJavaScriptHelper方法的具体用法?PHP Facebook::getJavaScriptHelper怎么用?PHP Facebook::getJavaScriptHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facebook\Facebook的用法示例。


在下文中一共展示了Facebook::getJavaScriptHelper方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fbUserInfoAction

 public function fbUserInfoAction()
 {
     $fb = new Facebook(['app_id' => '1475718472749501', 'app_secret' => 'a67fee083c27186f52030ff3a72f24f9', 'default_graph_version' => 'v2.4']);
     try {
         $helper = $fb->getJavaScriptHelper();
         $accessToken = $helper->getAccessToken();
         $fb->setDefaultAccessToken((string) $accessToken);
         $response = $fb->get('/me?locale=en_US&fields=name,email');
         $userNode = $response->getGraphUser();
         $email = $userNode->getField('email');
         $name = $userNode->getField('name');
         $arr = explode("@", $email);
         $login = $arr[0];
         $arr2 = explode(" ", $name);
         $firstname = $arr2[0];
         $lastname = $arr2[1];
         return new JsonResponse(['firstname' => $firstname, 'lastname' => $lastname, 'login' => $login, 'email' => $email]);
     } catch (FacebookResponseException $e) {
         // When Graph returns an error
         echo 'Graph returned an error: ' . $e->getMessage();
         exit;
     } catch (FacebookSDKException $e) {
         // When validation fails or other local issues
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
         exit;
     }
     exit;
 }
开发者ID:Aleksandr-Kachura,项目名称:public_html,代码行数:28,代码来源:LoginController.php

示例2: registerWithFacebook

 /**
  * Create a user account for the authenticated Facebook user.
  *
  * @return \Models\User
  * @throws \Facebook\Exceptions\FacebookSDKException
  * @throws \Facebook\Exceptions\FacebookSDKException
  * @throws \App\Exceptions\AccountDeactivatedException
  */
 public function registerWithFacebook()
 {
     // Load up the facebook sdk
     $fb = new Facebook(['app_id' => env('FACEBOOK_APP_ID'), 'app_secret' => env('FACEBOOK_APP_SECRET'), 'default_graph_version' => env('FACEBOOK_DEFAULT_GRAPH_VERSION')]);
     // Retrieve the access token
     $jsHelper = $fb->getJavaScriptHelper();
     $accessToken = $jsHelper->getAccessToken();
     if (!$accessToken) {
         throw new FacebookSDKException('The access token is invalid.');
     }
     // Get the profile info
     $profileResponse = $fb->get('/me', $accessToken);
     if ($profileResponse->getHttpStatusCode() != 200) {
         throw new FacebookSDKException('We could not retrieve your profile info.');
     }
     $profileInfo = $profileResponse->getGraphUser();
     // Check if the user is already registered
     $user = User::findBySocialAccountIdAndTypeId($profileInfo['id'], SocialAccountType::FACEBOOK);
     if ($user && !$user->active) {
         throw new AccountDeactivatedException();
     }
     // Create a new user account or update the existing one
     $user = $user ?: new User();
     $user->social_account_type_id = SocialAccountType::FACEBOOK;
     $user->social_account_id = $profileInfo['id'];
     $user->name = $profileInfo['name'];
     $user->email = isset($profileInfo['email']) ? $profileInfo['email'] : '';
     $user->location_name = isset($profileInfo['location']) ? $profileInfo['location']->getName() : '';
     $user->loggedin_at = date('Y-m-d H:i:s');
     $user->active = true;
     $user->save();
     return $user;
 }
开发者ID:slicvic,项目名称:wgg,代码行数:41,代码来源:Socializer.php

示例3: facebook

 public function facebook()
 {
     $this->load->library('session');
     $fb = new Facebook(['app_id' => '1068933233152181', 'app_secret' => 'cb86048c2ca95c034a26fe239e48a8eb']);
     /*
      *
      *@Trying to get and set the fucking token
      *
      */
     if (null !== $this->session->userdata('fb_token') && !empty($this->session->userdata('fb_token'))) {
         $accessToken = $this->session->userdata('fb_token');
     } else {
         $jsHelper = $fb->getJavaScriptHelper();
         // @TODO This is going away soon
         $facebookClient = $fb->getClient();
         try {
             $accessToken = $jsHelper->getAccessToken($facebookClient);
             $this->session->set_userdata('fb_token', $accessToken);
         } catch (Facebook\Exceptions\FacebookResponseException $e) {
             // When Graph returns an error
             echo 'Graph returned an error: ' . $e->getMessage();
         } catch (Facebook\Exceptions\FacebookSDKException $e) {
             // When validation fails or other local issues
             echo 'Facebook SDK returned an error: ' . $e->getMessage();
         }
     }
     //@TODO exchange echo for error
     /*
      *
      *@After we get the token, get user name & email with it,
      *	assign it a pin code, register him in the db + token + time of creation 
      *	redirect him to upload controller
      */
     if (isset($accessToken)) {
         // Logged in.
         //@TODO set a time=10min session if !sess[time]
         //@TODO check for Message: Error validating access token: Session has expired on Sunday, 20-Dec-15 13:00:00 PST. The current time is Sunday, 20-Dec-15 13:03:57 PST.
         $response = $fb->get('/me?locale=en_US&fields=name,email', $accessToken);
         $userNode = $response->getGraphUser();
         $this->session->set_userdata('name', $userNode['name']);
         //@TODO figure out a way to use pin once, maybe through session.
         $data['access_token'] = $accessToken;
         $this->load->model('register_model');
         //Create & check if pin is in use
         do {
             $pin = $this->generate_pin();
         } while ($this->register_model->check_pin($pin) === FALSE);
         if ($this->register_model->add($userNode['name'], $userNode['email'], $pin)) {
             $this->session->set_userdata('pin', $pin);
             $this->session->redirect(site_url('/upload'));
         }
     } else {
         //@TODO CREATE AN ERROR PAGE
         echo "Unable to read JavaScript SDK cookie";
     }
 }
开发者ID:n0rp3d,项目名称:foto.md,代码行数:56,代码来源:Register.php

示例4: verifyCredentials

 /**
  * 
  */
 public function verifyCredentials(Request $request)
 {
     $config = app()->make('config');
     $fb = new Facebook\Facebook(['app_id' => $config->get('services.facebook.client_id'), 'app_secret' => $config->get('services.facebook.client_secret'), 'default_graph_version' => 'v2.5']);
     $helper = $fb->getJavaScriptHelper();
     try {
         // $accessToken = $helper->getAccessToken();
         $accessToken = new AccessToken($request->input('accessToken'), $request->input('expiresIn'));
     } 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;
     }
     if (!isset($accessToken)) {
         echo 'No cookie set or no OAuth data could be obtained from cookie.';
         exit;
     }
     try {
         // Returns a `Facebook\FacebookResponse` object
         $response = $fb->get('/me?fields=id,name,email,picture,friends', $accessToken->getValue());
         /*$friendsResponse = $fb->get('/me/friends', $accessToken->getValue());
           //$result['data'];
           foreach($friendsResponse->getGraphEdge() as $node) {
             var_dump($node);
           }
           exit;*/
     } 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;
     }
     // Logged in
     $user = $response->getGraphUser();
     // var_dump($user);exit;
     // echo 'Name: ' . $user['name'];
     // $_SESSION['fb_access_token'] = (string) $accessToken;
     $authUser = $this->findOrCreateUser($user);
     app()['auth']->login($authUser, true);
     $hasher = app()->make('hash');
     /*var_dump( $hasher->make(
           "app()->make('config')->get('app.key')" . $authUser->facebook_id
       ));exit;*/
     return ['username' => $authUser->email, 'password' => app()->make('config')->get('app.pass_prefix') . $authUser->facebook_id];
     //return redirect()->route('home');
     // get posted credentials.
     // verify credentials against FB.
     // fetch user data.
     // check user existance: true => return user.
     // check user existance: false => register and return user.
 }
开发者ID:fusenlabs,项目名称:lumen-backend-api,代码行数:59,代码来源:FacebookController.php

示例5: getAccessToken

 /**
  *
  * @return Ambigous <\App\Helper\mixed, unknown, mixed>
  */
 public function getAccessToken()
 {
     if ($this->session->get('facebook_access_token')) {
         return $this->session->get('facebook_access_token');
     }
     $helper = $this->facebook->getJavaScriptHelper();
     try {
         $accessToken = $helper->getAccessToken();
     } catch (FacebookResponseException $e) {
         $this->logger->error('error: ' . $e->getMessage());
     } catch (FacebookSDKException $e) {
         $this->logger->error('Facebook SDK returned an error: ' . $e->getMessage());
     }
     if (!isset($accessToken)) {
         $this->logger->error('No cookie set or no OAuth data could be obtained from cookie.');
     } else {
         $this->logger->debug('Store new access token : ' . $accessToken);
         $this->session->set('facebook_access_token', (string) $accessToken);
     }
     return $this->session->get('facebook_access_token');
 }
开发者ID:mattimatti,项目名称:fbconnectquiz,代码行数:25,代码来源:Connect.php

示例6: fbcallback

 public function fbcallback()
 {
     $fb = new Facebook\Facebook(['app_id' => Config::get("facebook.appId"), 'app_secret' => Config::get("facebook.secret")]);
     $jsHelper = $fb->getJavaScriptHelper();
     // @TODO This is going away soon
     $facebookClient = $fb->getClient();
     try {
         $accessToken = $jsHelper->getAccessToken($facebookClient);
     } catch (Facebook\Exceptions\FacebookResponseException $e) {
         // When Graph returns an error
         return Redirect::to('/')->with('message', 'Graph returned an error: ' . $e->getMessage());
     } catch (Facebook\Exceptions\FacebookSDKException $e) {
         // When validation fails or other local issues
         return Redirect::to('/')->with('message', 'Facebook SDK returned an error: ' . $e->getMessage());
     } catch (Exception $e) {
         // generic exception
         return Redirect::to('/')->with('message', 'There was an error');
     }
     if (!isset($accessToken)) {
         return Redirect::to('/')->with('message', 'There was an error');
     }
     $response = $fb->get('/me?fields=id,name,email', $accessToken);
     $me = $response->getGraphObject();
     $gotoProfileCompletePage = false;
     $profile = Profile::whereUid($me['id'])->first();
     if (empty($profile)) {
         $user = new User();
         $user->name = $me['name'];
         $user->email = $me['email'];
         //$user->photo_large = 'https://graph.facebook.com/'.$me['username'].'/picture?type=large';
         $user->save();
         $profile = new Profile();
         $profile->uid = $me['id'];
         $profile->username = $me['email'];
         $profile->origin = 'fb';
         $profile->access_token = $accessToken;
         $profile->access_token_secret = $accessToken;
         $profile = $user->profiles()->save($profile);
         // first time, need to complete profile
         $gotoProfileCompletePage = true;
     }
     $profile->access_token = $accessToken;
     $profile->save();
     $user = $profile->user;
     Auth::login($user);
     if ($gotoProfileCompletePage) {
         return redirect('/login/complete');
     } else {
         return redirect('/');
     }
 }
开发者ID:algobasket,项目名称:eve-online-project,代码行数:51,代码来源:AuthController.php

示例7: callbackAction

 /**
  * @Route("/callback", name="callback")
  */
 public function callbackAction(Request $request)
 {
     $fb = new Facebook(['app_id' => $this->container->getParameter('fb_app_id'), 'app_secret' => $this->container->getParameter('fb_app_secret'), 'default_graph_version' => 'v2.5']);
     $accessToken = $fb->getJavaScriptHelper()->getAccessToken();
     if (!$accessToken) {
         throw new \RuntimeException('No cookie set or no OAuth data could be obtained from cookie');
     }
     $userInfo = $fb->get('/me?fields=id,name,email', $accessToken->getValue())->getDecodedBody();
     if (!isset($userInfo['id'])) {
         throw new \RuntimeException('Bad credentials');
     }
     $this->storeUserInfo($userInfo);
     return $this->redirectToRoute('homepage');
 }
开发者ID:squarer,项目名称:symfony3-demo,代码行数:17,代码来源:LoginController.php

示例8: __invoke

 /**
  * Example middleware invokable class
  *
  * @param  \Psr\Http\Message\ServerRequestInterface $request  PSR7 request
  * @param  \Psr\Http\Message\ResponseInterface      $response PSR7 response
  * @param  callable                                 $next     Next middleware
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function __invoke($request, $response, $next)
 {
     if (isset($_REQUEST['accessToken'])) {
         $accessToken = $_REQUEST['accessToken'];
         $this->fb->setDefaultAccessToken($accessToken);
     } else {
         /* @var $helper FacebookJavaScriptHelper */
         $helper = $this->fb->getJavaScriptHelper();
         $accessToken = $helper->getAccessToken();
     }
     if (!isset($accessToken)) {
         die("Not logged in or request expired");
     }
     try {
         /* @var $fbresponse FacebookResponse */
         $fbresponse = $this->fb->get('/me?fields=id', $accessToken);
         $user = $fbresponse->getGraphUser();
     } catch (Exception $e) {
         die($e->getMessage());
     }
     $next->setArgument('userid', $user->getId());
     $response = $next($request, $response);
     return $response;
 }
开发者ID:vidhu,项目名称:FoodBucketList-API,代码行数:33,代码来源:FBAuthMiddleWare.php

示例9: getPageDataFromId

 /**
  * Get band page data - name, genre, about, bio, band_members, photos 
  *
  * @param Illuminate\Http\Request;
  * @return mixed
  */
 public function getPageDataFromId(Request $request)
 {
     $this->id = $request->input('id');
     $facebook = new Facebook();
     $helper = $facebook->getJavaScriptHelper();
     $accessToken = $helper->getAccessToken();
     $query = '/' . $this->id . '?fields=name,genre,about,bio,band_members,picture.width(400).height(400),cover,albums{photos{images.width(500).height(500)}}';
     $band = $facebook->get($query, $accessToken)->getDecodedBody();
     //VALIDATOR NAPRAVITI
     if (!isset($band['bio'])) {
         $band['bio'] = 'Nema upisane biografije.';
     }
     if (!isset($band['genre'])) {
         $band['genre'] = '';
     }
     if (!isset($band['members'])) {
         $band['members'] = 'Nema upisanih članova benda.';
     }
     $this->band = $band;
     $this->storeBand($band);
     return view('app')->with('band', $band);
 }
开发者ID:VickoFranic,项目名称:epk-app,代码行数:28,代码来源:EpkController.php

示例10: getJavaScriptHelper

 /**
  * Returns the JavaScript helper.
  *
  * @return  \Facebook\Helpers\FacebookJavaScriptHelper
  */
 public function getJavaScriptHelper()
 {
     return $this->fb->getJavaScriptHelper();
 }
开发者ID:anqqa,项目名称:klubitus-octobercms-plugins,代码行数:9,代码来源:GraphAPI.php

示例11: callback_facebook

 /**
  * @author: lmkhang - skype
  * @date: 2015-12-28
  * Getting and Processing registration from FB API
  *
  */
 public function callback_facebook(Request $request)
 {
     //Check isLogged
     if ($this->isLogged()) {
         die;
     }
     //get Info of Dailymotion's API
     $fbook['api_key'] = \App\Config::where(['prefix' => 'fb', 'name' => 'api_key', 'del_flg' => 1])->get()[0]['value'];
     $fbook['api_secret'] = \App\Config::where(['prefix' => 'fb', 'name' => 'api_secret', 'del_flg' => 1])->get()[0]['value'];
     $fbook['scope'] = \App\Config::where(['prefix' => 'fb', 'name' => 'scope', 'del_flg' => 1])->get()[0]['value'];
     $fbook['url_callback'] = \App\Config::where(['prefix' => 'fb', 'name' => 'url_callback', 'del_flg' => 1])->get()[0]['value'];
     $fb = new Facebook(['app_id' => $fbook['api_key'], 'app_secret' => $fbook['api_secret'], 'default_graph_version' => 'v2.5']);
     $helper = $fb->getJavaScriptHelper();
     try {
         $accessToken = $helper->getAccessToken();
     } catch (FacebookResponseException $e) {
         // When Graph returns an error
         return Redirect::intended('/')->with('message', 'Hacking!!!!');
     } catch (FacebookSDKException $e) {
         // When validation fails or other local issues
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
         exit;
     }
     if (!isset($accessToken)) {
         echo 'No cookie set or no OAuth data could be obtained from cookie.';
         exit;
     }
     // Logged in
     if ($accessToken) {
         //set Facebook Login SESSION
         $session = new \Symfony\Component\HttpFoundation\Session\Session();
         $session->set('fb_access_token', (string) $accessToken);
         //get Info of User
         $fb->setDefaultAccessToken((string) $accessToken);
         #These will fall back to the default access token
         try {
             $res = $fb->get('/me?fields=id,name,email,first_name,last_name');
         } catch (FacebookSDKException $e) {
             echo $e->getMessage();
         }
         $user_get = $res->getGraphObject();
         //Check existed account
         $registration_system = config('constant.registration');
         $user = $this->checkAccountSNS(['username' => $user_get->getField('id')], $registration_system['facebook']);
         if (!$user) {
             //insert
             $match = new Libraries\Math();
             $register['refer'] = $match->to_base(rand(10, 30) . substr(time(), 5, 10) . rand(10, 30), 62) . $match->to_base(rand(100, 300) . substr(time(), 5, 10) . rand(100, 300), 62) . $match->to_base(rand(100, 300) . substr(time(), 5, 10) . rand(100, 300), 62);
             //from_refer
             if ($this->hasFlash('refer')) {
                 $register['from_refer'] = $this->getFlash('refer');
             } else {
                 $register['from_refer'] = 'no_refer';
             }
             $message_refer = $this->checkUserAttributes($register);
             $user = new \App\User();
             $user->refer = $register['refer'];
             $user->from_refer = !$message_refer ? $register['from_refer'] : '';
             $user->username = $user_get->getField('id');
             $user->first_name = $user_get->getField('first_name');
             $user->last_name = $user_get->getField('last_name');
             $user->full_name = $user_get->getField('name');
             $user->email = '';
             //$user_get->getField('email');
             $user->del_flg = 1;
             $user->registration_system = $registration_system['facebook'];
             $user->save();
             //Insert User Stats
             $user_stats = new \App\UserStats();
             $user_stats->user_id = $user->user_id;
             $user_stats->total = 0;
             $user_stats->del_flg = $user->del_flg;
             $user_stats->save();
         }
         //Set Session
         $this->setLogSession(['email' => $user->email, 'user_id' => $user->user_id, 'registration_system' => $user->registration_system]);
         //set Flash Message
         $this->setFlash('message', 'Welcome to MCN!');
         return Redirect::intended('/')->with('message', 'Welcome to MCN!');
     }
     //set Flash Message
     $this->setFlash('message', 'Error!');
     return Redirect::intended('/')->with('message', 'Error!');
 }
开发者ID:lmkhang,项目名称:mcntw,代码行数:90,代码来源:User.php

示例12: loginCallbackAction

 /**
  * @Route("/logincallback")
  */
 public function loginCallbackAction()
 {
     $fb = new Facebook(['app_id' => '763157317118688', 'app_secret' => '41ed5213e2e9161f8f31bf77c5e5c9e3', 'default_graph_version' => 'v2.5']);
     $helper = $fb->getJavaScriptHelper();
     try {
         $accessToken = $helper->getAccessToken();
     } catch (FacebookSDKException $e) {
         // When Graph returns an error
         echo 'Graph returned an error: ' . $e->getMessage();
     } catch (FacebookSDKException $e) {
         // When validation fails or other local issues
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
     }
     if (isset($accessToken)) {
         $fb->setDefaultAccessToken($accessToken);
         try {
             $requestProfile = $fb->get("/me?fields=id,name,email");
             $profile = $requestProfile->getGraphNode()->asArray();
         } catch (FacebookSDKException $e) {
             // When Graph returns an error
             echo 'Graph returned an error: ' . $e->getMessage();
         } catch (FacebookSDKException $e) {
             // When validation fails or other local issues
             echo 'Facebook SDK returned an error: ' . $e->getMessage();
         }
         $this->session->set('username', $profile['name']);
         $this->session->set('email', $profile['email']);
         if (!$this->checkFbIdExistinUserFor($profile['id'] . '_fb')) {
             $user = new User();
             $user->setUsername($profile['id'] . "_fb");
             $user->setHash($this->makeHash($profile['name'], $profile['email']));
             $user->setEmail($profile['email']);
             $user->setActivated(1);
             $user->setAvatarSrc($profile['id']);
             $user->setCreated(time());
             $em = $this->getDoctrine()->getManager();
             $em->persist($user);
             $em->flush();
         }
         $fb_user_id = $this->getUserResultFor($profile['id'] . "_fb")[0]['id'];
         $fb_username = $this->getUserResultFor($profile['id'] . "_fb")[0]['username'];
         $fb_created = $this->getUserResultFor($profile['id'] . "_fb")[0]['created'];
         $fb_avatar_src = $this->getUserResultFor($profile['id'] . "_fb")[0]['avatar_src'];
         $fb_email = $this->getUserResultFor($profile['id'] . "_fb")[0]['email'];
         $this->session->set('username', $fb_username);
         $this->session->set('fb_realm_name', $profile['name']);
         $this->session->set('user_id', $fb_user_id);
         $this->session->set('avatar_src', $fb_avatar_src);
         $this->session->set('email', $fb_email);
         $this->session->set('created', date('D M j G:i:s ', $fb_created));
         $this->session->set('fb_login', true);
         return $this->redirectToRoute('app_dashboard_account');
     } else {
         echo "Unauthorized access!!!";
         exit;
     }
 }
开发者ID:vinillo,项目名称:showcase,代码行数:60,代码来源:DashboardController.php

示例13: facebookAuth

 public function facebookAuth(Request $request, $slug)
 {
     try {
         $stack = Stack::where('slug', '=', $slug)->firstOrFail();
         $stackIntegration = StackIntegration::where('stack_id', '=', $stack->id)->where('type', '=', 'facebook')->where('is_enabled', '=', true)->firstOrFail();
         $fb = new Facebook(['app_id' => $stackIntegration->config['appId'], 'app_secret' => $stackIntegration->config['appSecret'], 'default_graph_version' => 'v2.4']);
         $jsHelper = $fb->getJavaScriptHelper();
         $accessToken = $jsHelper->getAccessToken();
         if (!isset($accessToken)) {
             throw new Exeption('Facebook Authentication failed');
         }
         $fb->setDefaultAccessToken($accessToken);
         $response = $fb->get('/me?fields=email,name,first_name,last_name,locale,gender');
         $userNode = $response->getGraphUser();
         if ($request->has('email')) {
             $userNode['email'] = $request->input('email');
         }
         $stackMember = StackMember::where('stack_id', '=', $stack->id)->where('email', '=', $userNode['email'])->first();
         if (!$stackMember) {
             $validSignupIp = $this->validSignupIp($request, $stack);
             $stackMember = new StackMember();
             $stackMember->email = $userNode['email'];
             $stackMember->referral_token = $this->generateRandomToken($stack->id);
             $stackMember->is_valid_signup_ip = $validSignupIp;
             $stackMember->name = $userNode['name'];
             $stackMember->first_name = $userNode['first_name'];
             $stackMember->last_name = $userNode['last_name'];
             $stackMember->gender = $userNode['gender'];
             $stackMember->locale = $userNode['locale'];
             $stackMember->fb_id = $userNode['id'];
             $stackMember->fb_accesstoken = $accessToken;
             $stackMember->ip = $request->getClientIp();
             $stackMember->stack_id = $stack->id;
             if ($request->session()->get('referral_user')) {
                 $stackMember->referred_by = $request->session()->get('referral_user');
             }
             $stackMember->save();
         } else {
             $stackMember->fb_id = $userNode['id'];
             $stackMember->fb_accesstoken = $accessToken;
             $stackMember->save();
         }
         Event::fire(new StackMemberSignedUp($stackMember));
         return redirect('member/' . $stackMember->referral_token);
     } catch (Facebook\Exceptions\FacebookResponseException $e) {
         // When Graph returns an error
         return redirect()->back()->withInput()->withErrors($e->getMessage());
     } catch (Facebook\Exceptions\FacebookSDKException $e) {
         // When validation fails or other local issues
         return redirect()->back()->withInput()->withErrors($e->getMessage());
     } catch (Exeption $e) {
         return redirect()->back()->withInput()->withErrors($e);
     }
 }
开发者ID:Hoasted,项目名称:laravel-5-boilerplate,代码行数:54,代码来源:StackController.php


注:本文中的Facebook\Facebook::getJavaScriptHelper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。