Files
cameleer-saas/ui/src/auth/useAuth.ts
hsiegeln 43967dcf2e
All checks were successful
CI / build (push) Successful in 42s
CI / docker (push) Successful in 41s
fix: add /platform prefix to signIn/signOut redirect URIs
LoginPage and useAuth used window.location.origin without the /platform
base path, causing redirect_uri mismatch with Logto's registered URIs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 23:25:53 +02:00

21 lines
493 B
TypeScript

import { useLogto } from '@logto/react';
import { useCallback } from 'react';
import { useOrgStore } from './useOrganization';
export function useAuth() {
const { isAuthenticated, isLoading, signOut, signIn } = useLogto();
const { currentTenantId } = useOrgStore();
const logout = useCallback(() => {
signOut(window.location.origin + '/platform/login');
}, [signOut]);
return {
isAuthenticated,
isLoading,
tenantId: currentTenantId,
logout,
signIn,
};
}