feat: 新增认证服务模块,包含用户注册、登录、令牌管理、GitHub OAuth及用户信息管理功能。
This commit is contained in:
@@ -141,7 +141,16 @@ export function getGitHubLoginUrl(state?: string): string {
|
||||
: '/api/v1';
|
||||
|
||||
console.log('[Auth] Generating GitHub URL with base:', baseUrl);
|
||||
const url = new URL(`${baseUrl}/auth/github`);
|
||||
|
||||
// 处理相对路径问题:URL构造函数依然需要完整的 base 才能处理相对路径
|
||||
let fullUrlString;
|
||||
if (baseUrl.startsWith('/')) {
|
||||
fullUrlString = `${window.location.origin}${baseUrl}/auth/github`;
|
||||
} else {
|
||||
fullUrlString = `${baseUrl}/auth/github`;
|
||||
}
|
||||
|
||||
const url = new URL(fullUrlString);
|
||||
if (state) {
|
||||
url.searchParams.append('state', state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user