javascript - 为网站创建 google 登录,但收到“错误:invalid_client 未找到 OAuth 客户端”。错误
问题描述
我正在尝试为我的网站创建一个谷歌登录页面。这是我到目前为止所拥有的,但是每当点击 google 按钮时,您只会收到一个
错误:invalid_client
未找到 OAuth 客户端。
错误。
这是我的代码:
<!DOCTYPE>
<html lang="en">
<head>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="288321056572-euu88orq4s5j4acoqmlne9ms3e2hn768.apps.googleusercontent.com
">
<script src="https://apis.google.com/js/platform.js" async defer></script>
</head>
<body>
<h1>Welcome to Studeo</h1>
<div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
<script>
function onSignIn(googleUser) {
// Useful data for your client-side scripts:
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Don't send this directly to your server!
console.log('Full Name: ' + profile.getName());
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
console.log("Image URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail());
// The ID token you need to pass to your backend:
var id_token = googleUser.getAuthResponse().id_token;
console.log("ID Token: " + id_token);
}
</script>
</body>
</html>
解决方案
推荐阅读
- three.js - 如何更改gltf文件中的密钥?
- antlr4 - 使用终止条件定义 Antlr 词法分析器规则
- spring-boot - 通过服务访问实体的瞬态字段
- python - 顶点反汇编器 python 在每个偏移量上返回相同的指令
- python - 在一行中运行整个 Python 脚本
- javascript - 右侧有负边距的 div 时无法设置溢出隐藏
- sql - Oracle SQL 根据字符数拆分字符串字段并在末尾附加一个字母
- javascript - 如何使用 Chart.js 使图表的背景颜色为渐变
- ios - 删除 UIVIewController 中的顶部空间 UIScrollview
- bash - 重写 curl 以便允许变量内的引号