背景:部分第三方平台需要作为独立登录源对接教育号登录,使用自己用户密码登录平台派发自己的code,然后到教育号对接第三方登录,需要教育号支持指定应用和带redirect_uri进行跳转。
数字基座应用跳转登录对接流程
前置工作
- 联系教育号配置第三方账号源
- 第三方实现对应的对接接口
- 第三方应用和要跳转的应用(比如智启学堂)都必须安装到学校
- 第三方和教育号需要维护相同的学校名字和编码
- 如果需要静默跳转,需要先配置跳转授权
sequenceDiagram
participant user as 第三方平台前端
participant third_platform as 第三方平台后端
participant thirdApp as 第三方应用
participant another_thirdApp as 另一个第三方应用
participant openidaas as 教育号
user ->> third_platform: 用户在第三方平台侧登录
third_platform -->> user: 登录成功
user ->> third_platform: 获取用户在第三方平台侧的code
third_platform -->> user: 返回第三方平台的code
user ->> openidaas: 调用pass/third_account_login 第三方登录
openidaas ->> third_platform: 调用 https://{第三方后台接口域名}/access_token 用code获取token
third_platform -->> openidaas: 返回token
openidaas ->> third_platform: 调用 https://{第三方后台接口域名}/userinfo?access_token={access_token} 获取用户信息
third_platform -->> openidaas: 返回用户信息
openidaas ->> openidaas: 根据学校名字+code匹配学校
openidaas ->> openidaas: 完成用户创建/用户匹配
openidaas ->> openidaas: 完成登录
openidaas ->> third_platform: 带着教育号code跳转应用首页或者指定的重定向地址
opt 消费code完成教育号登录
third_platform ->> third_platform: 完成教育号登录
end
opt 跳转其余第三方应用(比如智启学堂)
third_platform ->> another_thirdApp: 静默授权跳转
end
最佳实践
第三方登录跳转智启学堂
访问 https://sso.qq.com/pass/third_account_login 时
通过redirect_uri 指定跳转地址为 https://sso.qq.com/open/oauth2/authorize?base_appid={第三方平台的教育号应用id}&appid=700418
从而实现从第三方系统,直接跳转进入智启学堂