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

The OAuth client was not found. google login api

本文关键字:登录 api 谷歌 客户端 OAuth 找不到      更新时间:2023-09-26

我想在我的应用程序中使用谷歌登录api,但我有2个不同的错误。

 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.

我的凭证谷歌登录api是

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

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

我的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。

我有什么问题?

你的问题是,谷歌API没有看到你作为一个注册客户。

谷歌推特和许多现在使用OAuth 2.0,这意味着你必须是一个注册和已知的客户端到该平台之前使用它的API。

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

"The OAuth client was not found."

确保你是注册和承认谷歌和所有的凭据是正确的。