admin管理员组文章数量:1596328
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
如果你需要这些资料,可以戳这里获取
<title>WEB</title>
<script src="https://accounts.google/gsi/client" async></script>
<span id="blank\_zone" style="display: flex; justify-content: center; align-items: center; height: 25vh;"></span>
<span id="prompt" style="display: flex; justify-content: center; align-items: center;">
Please sign in with Google:
</span>
<br/>
<div id="login\_zone" style="display: flex; justify-content: center; align-items: center;">
<div id="g\_id\_onload"
data-client_id=“client_id”
data-context=“signin”
data-ux_mode=“popup”
data-auto_prompt=“false”
data-callback=“onLoginCallback”>
<div class="g\_id\_signin"
data-type=“standard”
data-shape=“pill”
data-theme=“filled_blue”
data-text=“signin_with”
data-size=“large”
data-logo_alignment=“left”>
<span id="user\_info" style="display: flex; justify-content: center; white-space: pre-line;"></span>
<script>
function onLoginCallback(response) {
var credential = response.credential,
sub_credential = credential.split(“.”)[1].replace(/-/g, “+”).replace(/_/g, “/”),
profile = JSON.parse(decodeURIComponent(escape(window.atob(sub_credential)))),
target = document.getElementById(“user_info”),
html = “”;
html += "ID: " + profile.sub + “\n”;
html += "Name: " + profile.name + “\n”;
html += "Email: " + profile.email + “\n”;
target.innerHTML = html;
document.getElementById(“prompt”).style.display = “none”;
document.getElementById(“login_zone”).style.display = “none”;
}
3.编写Web示例app.py: 应用以debug模式运行在本地的7777端口,端口号与Google中配置的一致
-*- coding: utf-8 -*-
from flask import Flask, render_template
app = Flask(name)
@app.route(“/”, methods=[“GET”])
def index():
return render_template(“index.html”)
if name == “__main__”:
app.run(host=“localhost”, port=7777, debug=True)
4.运行Web示例应用,即可使用Google账号登录网站
![](https://img-blog.csdnimg/direct/39060e9e9fc3415e84cc0717ca33c8ff.png#pic_center)
![](https://img-blog.csdnimg/direct/dc24b34b4f4247a1aaac353e3106e3d2.png#pic_center)
![](https://img-blog.csdnimg/direct/db5df7cf123541bcab36c1125efedaa5.png#pic_center)
注: 生产环境中需要自行实现代码逻辑,使用Google的credential来认证用户并管理用户会话的生命周期。
---
![img](https://img-blog.csdnimg/img_convert/bc68b93f668f600e1d07f0926496ebd6.png)
![img](https://img-blog.csdnimg/img_convert/a6d8700aa0788324f59222d1e8ab8a69.png)
![img](https://img-blog.csdnimg/img_convert/4747aa72245ddad65f7a021687a60ed0.png)
**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!**
**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**
**[如果你需要这些资料,可以戳这里获取](https://bbs.csdn/topics/618658159)**
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**
**[如果你需要这些资料,可以戳这里获取](https://bbs.csdn/topics/618658159)**
版权声明:本文标题:2024年最全使用Google账号登录个人网站(2),统统给你解决 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1728260218a1151218.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论