相关疑难解决方法(0)

来自Google API Oauth的客户端不是有效来源

我从Google API Oauth收到此错误:

idpiframe_initialization_failed",详细信息:"不是客户端的有效来源:http://127.0.0....为项目的客户端ID列出此来源

我正在尝试从此本地路径发送请求:

http://127.0.0.1:8887/

我已将此URL添加到Authorized JavaScript origin部分: 在此输入图像描述

这是我的代码:

<!-- The top of file index.html -->
<html itemscope itemtype="http://schema.org/Article">
<head>
  <!-- BEGIN Pre-requisites -->
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
  </script>
  <script src="https://apis.google.com/js/client:platform.js?onload=start" async defer>
  </script>
  <!-- END Pre-requisites -->

<!-- Continuing the <head> section -->
  <script>
    function start() {
      gapi.load('auth2', function() {
        auth2 = gapi.auth2.init({
          client_id: 'MY CLIENT ID.apps.googleusercontent.com',
          // Scopes to request in addition to 'profile' and 'email'
          //scope: 'https://www.google.com/m8/feeds/'
        });
      });
    }
  </script>




</head>
<body>


<button id="signinButton">Sign in …
Run Code Online (Sandbox Code Playgroud)

javascript oauth-2.0 google-oauth

29
推荐指数
6
解决办法
3万
查看次数

使用 Google OAuth2 时遇到问题(应用程序没有后端,因此只有客户端)

我正在尝试使用 OAuth 实现仅客户端登录。出现以下错误:

details: "You have created a new client application that uses libraries for user authentication or authorization that will soon be deprecated. New clients must use the new libraries instead; existing clients must also migrate before these libraries are deprecated. See the [Migration Guide](https://developers.google.com/identity/gsi/web/guides/gis-migration) for more information."
error: "idpiframe_initialization_failed"
Run Code Online (Sandbox Code Playgroud)

之后,每当我尝试登录时,都会收到以下错误:

error: "popup_closed_by_user"
[[Prototype]]: Object
Run Code Online (Sandbox Code Playgroud)

现在我正在 localhost:3000 上工作,所以我在 OAuth 2.0 客户端 ID 中添加了 http://localhost:3000 作为授权的 JS 源,还尝试将发布状态从测试更改为生产。用户类型设置为外部。

javascript google-oauth

15
推荐指数
2
解决办法
1万
查看次数

Google中的idpiframe_initialization_failed从Localhost登录

我正在尝试按照此链接创建一个谷歌登录按钮.到目前为止,帐户选择对话框即将到来,但之后我在控制台中看不到任何结果.相反,我在页面加载时收到此错误,

"idpiframe_initialization_failed", details: "Not a valid origin for the client: http://localhos…itelist this origin for your project's client ID."
details: "Not a valid origin for the client: http://localhost has not been whitelisted for client ID 386404527657-q4ss06np5g27dllq5ds7aif42udkh7e5.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
Run Code Online (Sandbox Code Playgroud)

这是代码,

<html lang="en">
  <head>
    <meta name="google-signin-scope" content="profile email">
    <meta name="google-signin-client_id" content="YOUR_CLIENT_ID.apps.googleusercontent.com">
    <script src="https://apis.google.com/js/platform.js" async defer></script> …
Run Code Online (Sandbox Code Playgroud)

javascript google-api google-oauth google-plus-signin google-signin

13
推荐指数
6
解决办法
1万
查看次数