Skip to main content

API Reference

AuthClient

The core authentication client for making requests to the accounts service.

Constructor

import { AuthClient } from '@groo.dev/auth-core'

const client = new AuthClient({
clientId: 'your-client-id',
clientSecret: 'your-client-secret', // Optional for client-side
baseUrl: 'https://accounts.groo.dev',
})

Methods

validateSession

Validate a session cookie and return the user:

const user = await client.validateSession(sessionCookie)
// Returns: ConsentedUser | null

getLoginUrl

Generate a login URL:

const url = client.getLoginUrl(redirectUri)
// Returns: string

getLogoutUrl

Generate a logout URL:

const url = client.getLogoutUrl(redirectUri)
// Returns: string

Exports

// Types
export type { User, ConsentedUser, AuthConfig, UseAuthReturn }

// Client
export { AuthClient }