feat: token generate with google logina dded
This commit is contained in:
@@ -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',
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user