您好我实现了我的网页登录facebook和谷歌登录。
通常情况下,facebook登录在我实施之前就已经开始了。然后我实施并使用谷歌登录。
我得到的错误是这样的,我的系统是php
致命错误:带有消息的未捕获异常'Google_Auth_Exception' '获取OAuth2访问令牌时出错,消息:'invalid_grant'' /hermes/bosnaweb09a/b1040/ipg.kazaniocom/google-login-api/libraries/Google/Auth/OAuth2.php:125 堆栈跟踪:#0 /hermes/bosnaweb09a/b1040/ipg.kazaniocom/google-login-api/libraries/Google/Client.php(128): Google_Auth_OAuth2-> authenticate('AQB-efkOtXD2MPr ...',false)#1 /hermes/bosnaweb09a/b1040/ipg.kazaniocom/google-login-api/index.php(56): Google_Client-> authenticate('AQB-efkOtXD2MPr ...')#2 /hermes/bosnaweb09a/b1040/ipg.kazaniocom/register.php(2): include('/ hermes / bosnawe ...')#3 {main}投入 /hermes/bosnaweb09a/b1040/ipg.kazaniocom/google-login-api/libraries/Google/Auth/OAuth2.php 在第125行
<script type="text/javascript"> function check_username(){var b=$('#username').val();if(b.length<3){$('#username').css('border','2px solid #a50000')}else{$.get("system/ajax.php?a=checkUser",{data:b},function(a){if(a==1){$('#username').css('border','2px solid #00a500')}else{$('#username').css('border','2px solid #a50000')}})}}function check_email(){var b=$('#email').val();if(b.length<3){$('#email').css('border','2px solid #a50000')}else{$.get("system/ajax.php?a=checkEmail",{data:b},function(a){if(a==1){$('#email').css('border','2px solid #00a500')}else{$('#email').css('border','2px solid #a50000')}})}}function check_email2(){var a=new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);var b=$('#email').val();var c=$('#email2').val();if(!a.test(c)){$('#email2').css('border','2px solid #a50000')}else if(b==c){$('#email2').css('border','2px solid #00a500')}else{$('#email2').css('border','2px solid #a50000')}}
$starttime = microtime(true);
define('BASEPATH', true);
include('system/config.php');
if(isset($google_user)){
//print_r($google_user);
$user_profile = $google_user;
$user_profile['first_name'] = $google_user['givenName'];
$login_through = "Google";
} else {
$login_through = "Facebook";
}
<?php
$loginUrl = $facebook->getLoginUrl(array("scope"=>"user_birthday,email,user_friends,user_relationships,user_hometown,user_education_history,user_work_history"));
?><a href="<?php echo $loginUrl;?>"><img src="img/fbcb.png" width="171" /></a><a href="<?php echo $google_login; ?>"><img src="img/gcb.png" width="205" /></a><?php
/*echo "<pre>";
print_r($lang);
print_r($user_profile);
echo "</pre>";*/
?>