2015-07-16 3 views
3

Я хочу использовать google-login api в своем приложении, но у меня есть две разные ошибки.Клиент OAuth не найден. google login api

1)Google login button is not rendering properly(Only render sometimes). 
2)when my button shows up i got "The OAuth client was not found." on click in popup window. 

Мои учетные данные для входа в систему Google API являются

Client ID :---> YOUR_CLIENT_ID 
Client secret :--->voMrsqhFNBtnh5FUvqy-jorI 
Redirect URIs :---->http://localhost:3000/ 
JavaScript origins :---> http://localhost:3000/ 

Я уже изменил мое имя проекта многие times.But он показывает мне ту же ошибку.

Моя HTML-страница ниже.

<!doctype html> 
<html lang="en" class="no-js"> 
<head> 

<link rel="stylesheet" href="../Scripts/vendor/bootstrap/dist/css/bootstrap.css"> 
    <link rel="stylesheet" href="../css/github-fork.css"> 
    <link rel="stylesheet" href="../css/bb-login.css"> 

<meta name="google-signin-client_id" content="YOUR_CLIENT_ID.apps.googleusercontent.com" 
     > 

</head> 

<body> 
    <div id="wrap"> 
    <div class="header"></div> 

    <div id="content" class="container"> 
      <script src="../Scripts/Vendor/requirejs/require.js" data-main="../Scripts/config.js"></script> 
     </div> 
    </div> 
<script src="https://apis.google.com/js/client:platform.js?onload=start" ></script> 
    <script type="text/javascript"> 
    function start() { 
    alert("inside start auth"); 
     gapi.load('auth2', function() { 
     var auth2 = gapi.auth2.getAuthInstance(); 
     alert(auth2); 
     }); 
     if (auth2.isSignedIn.get()) { 
     alert("inside profile"); 
    var profile = auth2.currentUser.get().getBasicProfile(); 
    console.log('ID: ' + profile.getId()); 
    console.log('Name: ' + profile.getName()); 
    console.log('Image URL: ' + profile.getImageUrl()); 
    console.log('Email: ' + profile.getEmail()); 
} 
    } 
    </script> 

</body> 
</html> 

и я добавить мои <div class="g-signin2"></div> в другой шаблон для Backbone.js.

В чем проблема?

ответ

-1

Проблема, с которой вы сталкиваетесь, заключается в том, что Google API не видит вас в качестве зарегистрированного клиента.

Google twitter и многие другие используют в настоящее время OAuth 2.0, что означает, что вы должны быть зарегистрированным и известным клиентом платформы, прежде чем использовать его API.

В вашем случае, Google не распознает вас как активный клиент, таким образом:

"The OAuth client was not found." 

Убедитесь, что вы зарегистрированы и признаны Google и что все учетные данные правильно.