Skip to content

Fix/auth/login url context path#312

Open
GoofySatoshi wants to merge 2 commits intonacos-group:masterfrom
GoofySatoshi:fix/auth/login-url-context-path
Open

Fix/auth/login url context path#312
GoofySatoshi wants to merge 2 commits intonacos-group:masterfrom
GoofySatoshi:fix/auth/login-url-context-path

Conversation

@GoofySatoshi
Copy link

@GoofySatoshi GoofySatoshi commented Mar 12, 2026

Fix Summary

修复了当 context_path='/' 时,访问 login 登录 URL 硬编码产生 token 获取失败的问题。
向前兼容了默认nacos注册中心启动时,默认前缀为/nacos的情况

Changes

  • v2/nacos/common/client_config.py: 优化 context_path 处理逻辑
  • v2/nacos/transport/auth_client.py: 正确拼接登录 URL

Test Coverage

 $  python -m unittest test.client_v2_test.TestClientV2.test_auth_login_url_with_root_context_path
ok

 $  python -m unittest test.client_v2_test.TestClientV2.test_auth_login_url_with_standard_context_path
ok

- Fixed 'get access token failed' error when nacos.server.contextPath is customized
- Updated auth_client.py to correctly construct the login URL with the server context path
- Ensures compatibility with Nacos Server 3.0.3+ custom context configurations
- Resolves issue nacos-group#300
@CLAassistant
Copy link

CLAassistant commented Mar 12, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants