feat: add CIE authentication callback page with polling mechanism for session verification

This commit is contained in:
gabdevele
2026-06-17 18:03:40 +02:00 Unverified
parent b75e7bbafd
commit 4c42c7963c
5 changed files with 397 additions and 1029 deletions
+13
View File
@@ -1,4 +1,6 @@
import type {
CieSessionResponse,
CieStartResponse,
CurrentUserResponse, EmailRequest, NotificationListResponse,
OkResponse,
OtpRequestResponse, RegisterCitizenRequest,
@@ -82,6 +84,15 @@ export const useAuth = () => {
const verifyOtp = (body: VerifyOtpRequest) =>
useApiFetch<TokenResponse>('/api/v1/auth/otp/verify', { method: 'POST', body })
const startCieLogin = (frontendRedirectUri: string) =>
useApiFetch<CieStartResponse>('/api/v1/auth/cie/start', {
method: 'POST',
body: { frontend_redirect_uri: frontendRedirectUri }
})
const fetchCieSession = (id: string) =>
useApiFetch<CieSessionResponse>(`/api/v1/auth/cie/session/${id}`, { method: 'GET' })
const updateProfile = (body: UpdateProfileRequest) =>
useApiFetch<CurrentUserResponse>('/api/v1/me', { method: 'PATCH', body })
@@ -110,6 +121,8 @@ export const useAuth = () => {
register,
requestOtp,
verifyOtp,
startCieLogin,
fetchCieSession,
updateProfile,
fetchCurrentUser,
fetchRewards,