Rev 484 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 484 | Rev 496 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | } |
42 | } |
43 | 43 | ||
44 | // Get access token |
44 | // Get access token |
45 | 45 | ||
46 | $ch = curl_init(); |
46 | $ch = curl_init(); |
47 | if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::basePath() . '/3p/certs/cacert.pem'); |
47 | if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::localpath() . '3p/certs/cacert.pem'); |
48 | curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/v8.0/oauth/access_token?". |
48 | curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/v8.0/oauth/access_token?". |
49 | "client_id=".urlencode(OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_CLIENT_ID'))."&". |
49 | "client_id=".urlencode(OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_CLIENT_ID'))."&". |
50 | "redirect_uri=".urlencode(OIDplus::getSystemUrl(false).OIDplus::webpath(__DIR__).'oauth.php')."&". |
50 | "redirect_uri=".urlencode(OIDplus::webpath(__DIR__,false).'oauth.php')."&". |
51 | "client_secret=".urlencode(OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_CLIENT_SECRET'))."&". |
51 | "client_secret=".urlencode(OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_CLIENT_SECRET'))."&". |
52 | "code=".$_GET['code'] |
52 | "code=".$_GET['code'] |
53 | ); |
53 | ); |
54 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
54 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
55 | $cont = curl_exec($ch); |
55 | $cont = curl_exec($ch); |
Line 63... | Line 63... | ||
63 | $access_token = $data['access_token']; |
63 | $access_token = $data['access_token']; |
64 | 64 | ||
65 | // Get user infos |
65 | // Get user infos |
66 | 66 | ||
67 | $ch = curl_init(); |
67 | $ch = curl_init(); |
68 | if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::basePath() . '/3p/certs/cacert.pem'); |
68 | if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::localpath() . '3p/certs/cacert.pem'); |
69 | curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/v8.0/me?". |
69 | curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/v8.0/me?". |
70 | "fields=id,email,name&". |
70 | "fields=id,email,name&". |
71 | "access_token=".urlencode($access_token) |
71 | "access_token=".urlencode($access_token) |
72 | ); |
72 | ); |
73 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
73 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
Line 100... | Line 100... | ||
100 | 100 | ||
101 | OIDplus::db()->query("UPDATE ###ra set last_login = ".OIDplus::db()->sqlDate()." where email = ?", array($email)); |
101 | OIDplus::db()->query("UPDATE ###ra set last_login = ".OIDplus::db()->sqlDate()." where email = ?", array($email)); |
102 | 102 | ||
103 | // Go back to OIDplus |
103 | // Go back to OIDplus |
104 | 104 | ||
105 | header('Location:'.OIDplus::getSystemUrl(false)); |
105 | header('Location:'.OIDplus::webpath(null,false)); |
106 | } |
106 | } |