@nexight-ai/ojo-cloud-auth-js
v0.1.1
Published
Browser SDK for generated OJO apps to start Google OAuth through the OJO broker hosted by `zk-agent-engine`.
Readme
@nexight-ai/ojo-cloud-auth-js
Browser SDK for generated OJO apps to start Google OAuth through the OJO broker hosted by zk-agent-engine.
Install
pnpm add @nexight-ai/ojo-cloud-auth-jsUsage
import { createOjoCloudAuth } from '@nexight-ai/ojo-cloud-auth-js';
const auth = createOjoCloudAuth({
brokerBaseUrl: 'https://ojo.art/api/agent-engine/v2/app/supabase/auth',
});
const result = await auth.signInWithOAuth('google', {
redirect_uri: window.location.origin,
extraParams: {
supabase_url: 'https://your-project.supabase.co',
},
});
if (result.redirected) {
return;
}
if (result.error) {
throw result.error;
}Notes
- Email/password flows should still call Supabase Auth directly from the generated frontend.
- Google OAuth requires
supabase_urlinextraParams; the broker resolves the bound project's runtime auth config server-side. - In iframe/preview contexts the SDK uses
popup + postMessage. - In top-level window contexts the SDK falls back to full-page redirect.
