360 Secure SkillHub
360 安全技能中心

a2a-Market-Google-OAuth

这是A2A市场的Google OAuth集成脚手架,已达可发布状态。核心功能含授权码流程实现、外部身份与内部账号映射、会话令牌生成;适用于买家/商家登录、身份验证端点开发场景。提供/auth/google/start等标准API,输出重定向URL、访问令牌等,具备状态校验、令牌哈希存储等安全基线,支持审计日志事件,后续可扩展账号合并等功能。

luoqianchenguni-max
luoqianchenguni-max
热度 52.91
最近更新 2026-05-11 17:33:38
分类:开发依赖:代码执行 / 第三方 API应用场景:代码生成 / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add a2a-market-google-oauth
Metadata
name
a2a-market-google-oauth
description
Handle Google OAuth login, account linking, and session bootstrap for A2A market users and operators. Use when implementing identity login endpoints, callback verification, and secure token/session lifecycle.

a2a-Market Google OAuth

Create a stable OAuth integration shell for buyer and merchant sign-in.

Current status: publish-ready scaffold. Keep flows explicit and deterministic before full SSO hardening.

Scope

  • Implement Google OAuth authorization code flow.
  • Link external identity to internal Agent/Operator profile.
  • Bootstrap session token and refresh workflow after callback.

Suggested Project Layout

  • app/integrations/oauth/google_client.py
  • app/interfaces/api/auth_routes.py
  • app/application/services/session_service.py
  • app/protocol/identity/user_identity_mapper.py

Minimum Contracts (MVP P0)

  1. GET /auth/google/start builds state + redirect URL.
  2. GET /auth/google/callback validates state and exchanges code.
  3. upsert_identity(provider, provider_user_id, email) returns internal principal id.
  4. create_session(principal_id) returns short-lived access token and refresh token.

Security Baseline

  • Validate state and nonce against server-side cache.
  • Reject callback if issuer/audience do not match configuration.
  • Store only hashed refresh tokens and rotate on use.

Events

  • Emit login event to audit log stream.
  • Emit session-created event for WebSocket presence bootstrap.

Implementation Backlog

  • Add account merge flow for duplicate emails across providers.
  • Add step-up verification for risky sessions.

Runtime Implementation

  • Status: implemented in local runtime package.
  • Primary code paths:
  • runtime/src/integrations/oauth/google-oauth-service.js
  • Validation: covered by runtime/tests and npm test in runtime/.