nightingale icon indicating copy to clipboard operation
nightingale copied to clipboard

After OIDC configuration, users can be created successfully but cannot be redirected directly to the home page

Open nashzosi opened this issue 3 months ago • 0 comments

Question and Steps to reproduce

Image OIDC配置后可以正常创建出用户但是无法直接跳转到首页 等待出现图片上的报错后新开标签页通过域名加端口可以正常进入首页

怀疑是code进行了第二次消费,导致了失效,不知道为什么会有 二次消费 检查了 对比了OID服务器、客户端、n9e 三个机器的时间 一致 对比了RedirectURL 一致

oidc服务端的配置:

Image

Relevant logs and configurations

配置:
Enable = true
DisplayName = 'OIDC登录'
RedirectURL = 'http://n9e.我的域名.com:18000/callback'
SsoAddr = 'https://bc.我的域名.com/api/v1/oauth2'
SsoLogoutAddr = 'https://n9e.我的域名.com:18000/session/end'
ClientId = '77fCiSiBwTxxxxxxxxxxxxcrdt2gUU'
ClientSecret = 'AbEH3bNaCPwxxxxxxxxxxxxxxxxxxxxx4Vb1Db2CcTB3m73'
DefaultRoles = ['Standard']
CoverAttributes = true
# 请求的OIDC范围
Scopes = ['openid', 'profile', 'email', 'phone']

# OIDC的用户属性映射n9e的用户属性
[Attributes]
# 用户名字段的映射
Username = 'Username'
# 昵称字段的映射
Nickname = 'nickname'
# 电话字段的映射
Phone = 'phone_number'
# email字段映射
Email = 'email'


日志(日志和图片code对不上但是报错是一样的):
2025-09-18 17:40:42.302588 DEBUG oidcx/oidc.go:272 sso_exchange_user: userinfo claims:map[Username:xingming email:xingming@我的域名.cn id:202188888888888-1DBEF7398 nickname:姓名 phone_number:+86-18500000000]
2025-09-18 17:40:42.668835 ERROR router/router_login.go:254 sso_callback fail. code:IRxxxxxxxxxxxx68q5RYKFgepmc, state:, get ret: <nil>. error: sso_exchange_user fail. code:IRgjBxKUtYa6QP3gdEKVz3aiPG6crh68q5RYKFgepmc, error:failed to exchange token: oauth2: "invalid_grant" "Invalid authorization code: IRgjBxKUtYa6QP3gdEKVz3aiPG6crh68q5RYKFgepmc"

oidc的配置:

Version

v8.3.1

nashzosi avatar Sep 18 '25 10:09 nashzosi