找不到OAuth客户端。谷歌登录api

时间:2015-07-16 04:21:31

标签: javascript jquery html google-login

我想在我的应用程序中使用google-login api,但我有2个不同的错误。

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

我的google login api凭据是

<!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>

我已经多次更改了我的项目名称。但它显示了同样的错误。

我的HTML页面如下。

<div class="g-signin2"></div>

我将{{1}}添加到backbone.js的不同模板中。

我有什么问题?

1 个答案:

答案 0 :(得分:-1)

您遇到的问题是,Google API无法将您视为注册客户端。

谷歌推特以及现在的更多用途OAuth 2.0,这意味着在使用它的API之前,您必须是该平台的注册和已知客户端。

在您的情况下,谷歌不承认您是活跃的客户,因此:

"The OAuth client was not found."

确保您已注册并通过Google确认并且所有凭据都是正确的。