_:n4ac8190ce428433ab71654d10f9e7c40xb43
<http://schema.org/text>
"Here you go\n\n&lt;?php\n/*\n * login_with_facebook.php\n *\n * Modified for ezSocial contrib for osCommerce by Christopher Trigg Jan 2015\n *\n * @(#) $Id: login_with_facebook.php,v 1.3 2013/07/31 11:48:04 mlemos Exp $\n *\n */\n\n        require('ezsocial/settings.php');\n        require('ezsocial/functions.php');\n        require('ezsocial/http.php');\n        require('ezsocial/oauth_client.php');\n\n        $ezsocial_uri = $ezsocial_protocol.$_SERVER['HTTP_HOST'].dirname(strtok($_SERVER['REQUEST_URI'],'?'));\n        if(substr($ezsocial_uri, -1) != '/')\n                $ezsocial_uri .= '/';\n        $ezsocial_uri .= 'login_with_facebook.php';\n\n        $client = new oauth_client_class;\n        $client-&gt;debug = false;\n        $client-&gt;debug_http = false;\n        $client-&gt;display = \"popup\";\n        $client-&gt;server = 'Facebook';\n        $client-&gt;redirect_uri = $ezsocial_uri;\n        $client-&gt;client_id = $ezsocial_facebook_client_id;\n        $client-&gt;client_secret = $ezsocial_facebook_client_secret;\n\n        $client-&gt;scope = 'email';\n        if(($success = $client-&gt;Initialize())) {\n                if(($success = $client-&gt;Process())) {\n                        if(strlen($client-&gt;access_token)) {\n                                $success = $client-&gt;CallAPI(\n                                        'https://graph.facebook.com/me',\n                                        'GET', array(\n                                                'fields'=&gt;'first_name,last_name,gender,email'\n                                        ), array('FailOnAccessError'=&gt;true), $user);\n                        }\n                }\n                $success = $client-&gt;Finalize($success);\n        }\n        if($client-&gt;exit)\n                exit;\n        if($success) {\n                if($ezsocial_debug_uri) {\n                        echo(\"REDIRECT URI: \".$ezsocial_uri);\n                        exit();\n                }\n                if($ezsocial_debug_errors) {\n                        error_log(\"ezSocial: Provider data: \".print_r($user,true));\n                }\n                require('includes/application_top.php');\n\n                if(isset($user-&gt;email) &amp;&amp; (strlen($user-&gt;email) &gt; 3))\n                        $email = $user-&gt;email;\n                else {\n                        echo \"Facebook Social Login Error:\".\"\\n\";\n                        echo $ezsocial_email_missing;\n                        exit();\n                }\n\n                if(isset($user-&gt;first_name) &amp;&amp; (strlen($user-&gt;first_name) &gt; 0))\n                        $first = $user-&gt;first_name;\n                else\n                        $first = 'Unknown';\n\n                if(isset($user-&gt;last_name) &amp;&amp; (strlen($user-&gt;last_name) &gt; 0))\n                        $last = $user-&gt;last_name;\n                else\n                        $last = 'Unknown';\n\n                if(isset($user-&gt;gender) &amp;&amp; (strlen($user-&gt;gender) &gt; 0))\n                        $gender = $user-&gt;gender;\n                else\n                        $gender = 'Unknown';\n\n                if($gender == 'male')\n                        $gender = 'm';\n                else if($gender == 'female')\n                        $gender = 'f';\n\n                $ezsocial_t = (string) ceil(time()/60);\n                $ezsocial_data = 'ezsocial|'.$ezsocial_t.'|facebook|'.$first.'|'.$last.'|'.$gender.'|'.$email;\n                $ezsocial_hash = mc_encrypt($ezsocial_data, ezsocial_get_key());\n                tep_redirect('ezsocial_success.php?login='.$ezsocial_hash);\n        } else  {\n                echo \"Social Login Failure, please go back and try again\";\n        }\n\n?&gt;\n\nMake sure you have the latest version of EZSocial installed"
<https://forums.oscommerce.com/topic/399578-contribution-ez-social-login-for-google-facebook-linkedin-microsoft/?tab=comments#comment-1737313>