手机登陆和google登陆参数变更

This commit is contained in:
andy
2026-06-22 17:20:06 +08:00
parent 563b72ff90
commit 8568c07d9f
2 changed files with 14 additions and 6 deletions

View File

@@ -1,11 +1,11 @@
import { storeAuthTokens } from "@/constants/token";
import type { OAuthTokenResponse } from "@/constants/token";
import { request, requestRaw } from "../utils/request";
import { getRequestContext, request, requestRaw } from "../utils/request";
// 获取oauth token
export interface OauthTokenRequest {
grant_type?: string;
openIdCode?: string[];
idToken?: string[];
scope?: string;
mobile?: string;
code?: string;
@@ -34,7 +34,11 @@ export function buildFormUrlEncodedParams(
export async function oauthToken(
data: OauthTokenRequest,
): Promise<OAuthTokenResponse> {
const params = buildFormUrlEncodedParams(data as Record<string, unknown>);
const params = buildFormUrlEncodedParams({
...data,
clientId: data.clientId ?? getRequestContext().clientId ?? "6",
clientConfigld: data.clientConfigld ?? getRequestContext().clientId ?? "6",
} as Record<string, unknown>);
const res = await requestRaw<OAuthTokenResponse>(
{
@@ -66,7 +70,12 @@ export function sendCode(mobile: string) {
url: `/admin/platformUser/sendMobileCode/${encoded}`,
method: "get",
},
{ skipAuth: true },
{
skipAuth: true,
headers: {
clientConfigId: getRequestContext().clientId ?? "",
},
},
);
}

View File

@@ -253,7 +253,6 @@ async function handlePhoneLogin() {
mobile: `${selectedCountry.value.dialCode}${phoneDigits}`,
code: codeValue,
grant_type: "mobile",
clientConfigld: '6',
});
emitter.emit(NOTICE_EVENT_LOGIN_SUCCESS);
await navigateAfterLogin();
@@ -332,7 +331,7 @@ onMounted(() => {
const idToken = response.credential;
if (idToken) {
oauthToken({ openIdCode: [idToken], grant_type: 'google', clientConfigld: '6' })
oauthToken({ idToken: [idToken], grant_type: 'google' })
.then(() => {
emitter.emit(NOTICE_EVENT_LOGIN_SUCCESS);
return navigateAfterLogin()