feat: token generate with google logina dded

This commit is contained in:
مهرزاد قدرتی
2025-08-17 16:45:29 +03:30
parent 983c25ad94
commit ef47214176
2 changed files with 37 additions and 3 deletions

View File

@@ -59,3 +59,25 @@ export const generateTokenWithOtp = (request: GenerateTokenWithOTP) => {
},
);
};
export interface GenerateTokenWithGoogle {
idToken: string;
}
export const generateTokenWithGoogle = (request: GenerateTokenWithGoogle) => {
const body = new URLSearchParams();
body.set('grant_type', 'google');
body.set('client_id', import.meta.env.VITE_IDENTITY_CLIENT_ID);
body.set('scope', import.meta.env.VITE_IDENTITY_SCOPE);
body.set('idtoken', request.idToken);
return apiClient.post<GenerateTokenResponse>(
import.meta.env.VITE_IDENTITY_URL,
body.toString(),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
},
);
};