diff --git a/.env b/.env index c179fb2..28623f6 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -VITE_GOOGLE_CLIENT_ID=https://272098283932-bft2gvlgjn8edopg0lnqjq1i9ekdmipt.apps.googleusercontent.com +VITE_GOOGLE_CLIENT_ID=272098283932-bft2gvlgjn8edopg0lnqjq1i9ekdmipt.apps.googleusercontent.com VITE_DEFUALT_AUTH_RETURN_URL=/setting/profile VITE_APP_URL=https://accounts.business-harmony.com VITE_API_URL=https://accounts.business-harmony.com/api diff --git a/index.html b/index.html index 6255f17..5385387 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,7 @@ } catch (e) {} })(); + diff --git a/src/features/authentication/components/AuthenticationSteps/GoogleAuthentication.tsx b/src/features/authentication/components/AuthenticationSteps/GoogleAuthentication.tsx index 275a430..a5bfafa 100644 --- a/src/features/authentication/components/AuthenticationSteps/GoogleAuthentication.tsx +++ b/src/features/authentication/components/AuthenticationSteps/GoogleAuthentication.tsx @@ -25,6 +25,9 @@ export interface GoogleAuthenticationProps { ) => void; } +/** + * @deprecated use V2 instead + */ export const GoogleAuthentication = ({ disabled, authFactory, @@ -44,11 +47,8 @@ export const GoogleAuthentication = ({ document.body.appendChild(script); script.onload = () => { - clientRef.current = google.accounts.oauth2.initCodeClient({ + clientRef.current = google.accounts.id.initialize({ client_id: import.meta.env.VITE_GOOGLE_CLIENT_ID, - scope: 'openid email profile', - ux_mode: 'popup', - response_type: 'code', callback: async (resp: GoogleCodeClientResponse) => { const apiRequest: LoginOrSignUpWithGoogleRequest = { idToken: resp.id_token, @@ -88,6 +88,7 @@ export const GoogleAuthentication = ({ return ( + + ); +}; diff --git a/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx b/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx index 4ba2f7f..11901f2 100644 --- a/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx +++ b/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx @@ -9,12 +9,11 @@ import { CountryCodeSelector } from '../CountryCodeSelector'; import type { LoginResult, UserStatus } from '../../types/userTypes'; import { getUserStatusByPhoneNumberOrEmail } from '../../api/authorizationAPI'; import type { CountryCode } from '@/types/commonTypes'; -import { GoogleAuthentication } from './GoogleAuthentication'; import { isPhoneNumber } from '@/utils/regexes/isValidPhoneNumber'; import { useToast } from '@rkheftan/harmony-ui'; import { useApi } from '@/hooks/useApi'; import type { GenerateTokenResponse } from '../../api/identityAPI'; -import { replacePersianWithRealNumbers } from '@/utils/replacePersianWithRealNumbers'; +import { GoogleAuthenticationV2 } from './GoogleAuthenticationV2'; export interface LoginRegisterFormProps { loginRegisterValue: string; @@ -175,7 +174,7 @@ export function LoginRegisterForm({ {t('loginForm.submitButton')} -