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>
21 lines
493 B
TypeScript
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,
|
|
};
|
|
}
|