96SEO 2026-06-16 21:35 1
公司目前Zuo的是一款激光雕刻产品,主要用于出口海外需要开发一个web社区网站用于桌面端模型生成后发布到社区进行分享和交流。说到出海产品,google第三方登录是必须接入的,这两天和后端一起开发完成了此功Neng,现将流程大概梳理如下。
第一步:在Google API Console创建 OAuth 凭据我们Ke以kan到文档提供了多种应用类型的接入方式,对于web来说主要是红框里的两种。

适用于 JavaScript Web 应用
适用于服务器端 Web 应用
第二步:接入方式和流程文档地址:developers.google.com/identity/pr…
另外对于前端交互来说均有两种可供选择:
popup模式:在当前页面弹窗授权,体验geng友好。
redirect模式:跳转新页面授权后重定向回来。
popup模式popup模式,采用vue3-google-login第三方依赖。需要注意的点:
Google凭据那里不需要配置重定向URI,且后端用code换取access_token所传的参数redirect_uri应该为“postmessage”,否则会报错“redirect_uri_mismatch”。
code不Neng重复使用。
接入流程:前端唤起 Google 授权 → 前端获取授权码 → 后端用授权码换 token → 验证用户信息并返回自有 token
<template> <GoogleLogin :client-id="googleClientId" popup-type="CODE" :callback="handleGoogleSuccess" :error="handleGoogleError" > <img class="google-login-icon" src="@/assets/icons/google.png" alt="google-login"> <button v-if="false" class="google-login-button" type="button"> <span class="google-mark">G</span> <span class="google-label">{{ buttonLabel }}</span> </button> </GoogleLogin></template><script setup lang="ts">import { ElMessage } from 'element-plus'import { GoogleLogin, type CallbackTypes } from 'vue3-google-login'import { useUserStore } from '@/stores/user'interface Props { buttonLabel?: string}interface Emits { : void : void}withDefaults, { buttonLabel: 'Google 账号快捷登录',})const emit = defineEmits<Emits>const userStore = useUserStoreconst googleClientId = import.meta.env.VITE_GOOGLE_CLIENT_ID as string | undefinedconst handleGoogleSuccess = async => { if { ElMessage.error emit return } const success = await userStore.userLoginByGoogleCode if { emit return } emit}const handleGoogleError = => { ElMessage.error emit}</script><style scoped lang="scss">.google-login-button { width: 176px; height: 44px; border: 1px solid #d9d9d9; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; gap: ; cursor: pointer;}.google-login-button:hover {}
redirect模式
redirect模式,期间由于踩了上面提的popup模式的坑,也改过一版redirect模式,没有采用第三方依赖。
<template> <button class="google-login-trigger" type="button" @click="handleGoogleLogin"> <img class="google-login-icon" src="@/assets/icons/google.png" alt="google-login" /> <span class="sr-only">{{ buttonLabel }}</span> </button></template><script setup lang=ts>import { ElMessage } from 'element-plus'interface Props { buttonLabel?: string}interface Emits { : void : void}withDefaults, { buttonLabel: 'Google 快捷登录',})const emit = defineEmits>`</script>`
,说实话,你有没有遇到过写完文章,发到网上却发现百度就是不收录?
,害,我是有过这样的经历!
,咱就是说,到底是为什么呢?
,你懂的,有时候咱也不想讲那些大道理,直接上干货多好!
,那个那个,有人说是网站权重太低,那怎么办?
主要前端完成google登录,后端只需要接收前端返回的token进行验证即可。 接入流程:用户点击登录 → 授权 -> 前端直接获得idtoken + 用户信息 -> idtoken 发给后端验证 → 完成登录。 我们目前采用的方式,需要后端存储google用户信息。 前端测试通过code换取accesstoken时postman需要设置请求头“Content-Type: application/x-www-form-urlencoded”,否则会报错“invalidgrant”。 当然是kanGoogle的OAuth .0文档,了解其流程和参数。作为专业的SEO优化服务提供商,我们致力于通过科学、系统的搜索引擎优化策略,帮助企业在百度、Google等搜索引擎中获得更高的排名和流量。我们的服务涵盖网站结构优化、内容优化、技术SEO和链接建设等多个维度。
| 服务项目 | 基础套餐 | 标准套餐 | 高级定制 |
|---|---|---|---|
| 关键词优化数量 | 10-20个核心词 | 30-50个核心词+长尾词 | 80-150个全方位覆盖 |
| 内容优化 | 基础页面优化 | 全站内容优化+每月5篇原创 | 个性化内容策略+每月15篇原创 |
| 技术SEO | 基本技术检查 | 全面技术优化+移动适配 | 深度技术重构+性能优化 |
| 外链建设 | 每月5-10条 | 每月20-30条高质量外链 | 每月50+条多渠道外链 |
| 数据报告 | 月度基础报告 | 双周详细报告+分析 | 每周深度报告+策略调整 |
| 效果保障 | 3-6个月见效 | 2-4个月见效 | 1-3个月快速见效 |
我们的SEO优化服务遵循科学严谨的流程,确保每一步都基于数据分析和行业最佳实践:
全面检测网站技术问题、内容质量、竞争对手情况,制定个性化优化方案。
基于用户搜索意图和商业目标,制定全面的关键词矩阵和布局策略。
解决网站技术问题,优化网站结构,提升页面速度和移动端体验。
创作高质量原创内容,优化现有页面,建立内容更新机制。
获取高质量外部链接,建立品牌在线影响力,提升网站权威度。
持续监控排名、流量和转化数据,根据效果调整优化策略。
基于我们服务的客户数据统计,平均优化效果如下:
我们坚信,真正的SEO优化不仅仅是追求排名,而是通过提供优质内容、优化用户体验、建立网站权威,最终实现可持续的业务增长。我们的目标是与客户建立长期合作关系,共同成长。
Demand feedback