
Product
Socket Now Protects the Firefox Extension Ecosystem
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.
@hellocoop/better-auth
Advanced tools
A Better Auth plugin for seamless integration with Hellō - the simple, secure, and privacy-focused authentication service.
npm install @hellocoop/better-auth
Option 1: Quick Setup (Recommended)
npx @hellocoop/quickstart
This streamlines the entire process and displays your client_id in the terminal.
Tip: The quickstart command accepts various CLI flags. See the CLI parameters documentation for details.
Option 2: Manual Setup
Visit console.hello.coop to create a free application and obtain your clientId.
To use the Hellō Better Auth plugin, add it to your auth config.
// auth.ts
import { betterAuth } from 'better-auth'
import { hellocoop } from '@hellocoop/better-auth'
export const auth = betterAuth({
plugins: [
hellocoop({
config: {
clientId: 'app_123_xyz', // Your Hellō client ID from step 2
scopes: ['openid', 'profile', 'email'], // Optional: customize scopes
prompt: 'consent', // Optional: 'login' or 'consent'
// other config options
},
}),
],
})
Include the Hellō Better Auth client plugin in your authentication client setup:
// auth-client.ts
import { createAuthClient } from 'better-auth/client'
import { hellocoopClient } from '@hellocoop/better-auth'
export const authClient = createAuthClient({
plugins: [hellocoopClient()],
})
The Hellō Better Auth plugin provides secure authentication endpoints and utilities. Here's how to implement them:
// Initiate the sign-in process
const { data, error } = await authClient.signInWithHello({
callbackURL: '/dashboard',
errorCallbackURL: '/error-page',
})
if (error) {
console.error('Sign-in failed:', error)
return
}
// User will be redirected to Hellō for authentication
const { data, error } = await authClient.signInWithHello({
callbackURL: '/dashboard',
errorCallbackURL: '/error-page',
scopes: ['openid', 'profile', 'email'],
prompt: 'consent', // Force consent screen
providerHint: 'google,github', // Suggest specific providers
loginHint: 'user@example.com', // Pre-fill email
domainHint: 'company.com', // Suggest domain for login
})
| Parameter | Description | Type | Default |
|---|---|---|---|
callbackURL? | URL to redirect after successful sign-in | string | / |
errorCallbackURL? | URL to redirect if an error occurs | string | /error |
scopes? | Array of scopes to request. See supported scopes | string[] | ['openid'] |
providerHint? | Comma-separated list of preferred providers to show new users | string | - |
loginHint? | Pre-fill email in the login form | string | - |
domainHint? | Suggest domain for user login | string | - |
prompt? | login forces fresh login; consent shows consent screen for profile updates | string | - |
The plugin automatically handles the OAuth callback at /api/auth/hellocoop/callback. No additional setup required.
// Sign out the current user
await authClient.signOut()
await authClient.signOut({
fetchOptions: {
onSuccess: () => {
// Redirect after successful sign-out
window.location.href = '/login'
},
onError: (error) => {
console.error('Sign-out failed:', error)
},
},
})
Include the Hellō button styles in your HTML document:
<link rel="stylesheet" href="https://cdn.hello.coop/css/hello-btn.css" />
import { ContinueButton } from '@hellocoop/better-auth'
function LoginPage() {
const handleSignIn = async () => {
const { data, error } = await authClient.signInWithHello({
callbackURL: '/dashboard',
errorCallbackURL: '/error-page',
scopes: ['openid', 'profile', 'email'],
})
if (error) {
console.error('Sign-in failed:', error)
}
}
return (
<div>
<h1>Welcome to My App</h1>
<ContinueButton onClick={handleSignIn}>
Continue with Hellō
</ContinueButton>
</div>
)
}
// Apply custom CSS classes
<ContinueButton
className="hello-btn-white hello-btn-hover-flare"
onClick={handleSignIn}
>
Sign in with Hellō
</ContinueButton>
Available Button Styles:
hello-btn-black - Black button (default)hello-btn-white - White buttonhello-btn-hover-glow - Glow effect on hoverhello-btn-hover-flare - Flare effect on hoverSee the complete button customization guide for more styling options.
Note: Advanced theming properties from
@hellocoop/reactare coming soon. Currently, use CSS classes via theclassNameprop for customization.
Configure the Hellō plugin with these options:
interface HellocoopConfig {
/** Your Hellō application client ID (required) */
clientId: string
/** OAuth scopes to request (optional) */
scopes?: string[]
/** Authentication prompt behavior (optional) */
prompt?: 'login' | 'consent'
/** Enable PKCE for enhanced security (optional, defaults to true) */
pkce?: boolean
}
| Option | Type | Default | Description |
|---|---|---|---|
clientId | string | Required | Your Hellō application client ID from console.hello.coop |
scopes | string[] | ['openid'] | OAuth scopes to request. See available scopes |
prompt | 'login' | 'consent' | undefined | login forces fresh authentication; consent shows profile update screen |
pkce | boolean | true | Enables PKCE (Proof Key for Code Exchange) for enhanced security |
The plugin provides comprehensive error handling for authentication flows:
const { data, error } = await authClient.signInWithHello({
callbackURL: '/dashboard',
errorCallbackURL: '/auth-error',
})
if (error) {
// Handle different error types
switch (error.message) {
case 'oauth_code_verification_failed':
console.error('Invalid authorization code')
break
case 'user_info_is_missing':
console.error('Could not retrieve user information')
break
case 'email_is_missing':
console.error('User email not provided by Hellō')
break
default:
console.error('Authentication error:', error.message)
}
}
Common Error Codes:
oauth_code_verification_failed - Invalid or expired authorization codeuser_info_is_missing - Unable to fetch user profile from Hellōemail_is_missing - User email not available in the responsename_is_missing - User name not available in the responseSet up environment variables for different environments:
# .env.local
HELLOCOOP_CLIENT_ID=app_123_xyz
# .env.production
HELLOCOOP_CLIENT_ID=app_456_abc
// Use in configuration
hellocoop({
config: {
clientId: process.env.HELLOCOOP_CLIENT_ID!,
},
})
Issue: "Invalid OAuth configuration" error
clientId is correct and the application is properly configured in console.hello.coopIssue: User claims not updating
overrideUserInfo: true in your configuration (this is now the default)Issue: Callback URL not working
https://yourdomain.com/api/auth/hellocoop/callbackIssue: Button styles not loading
<link rel="stylesheet" href="https://cdn.hello.coop/css/hello-btn.css" />Enable debug logging to troubleshoot issues:
export const auth = betterAuth({
logger: {
level: 'debug', // Enable debug logs
},
plugins: [
hellocoop({
/* config */
}),
],
})
FAQs
Better Auth plugin for Hellō - https://hello.dev
The npm package @hellocoop/better-auth receives a total of 0 weekly downloads. As such, @hellocoop/better-auth popularity was classified as not popular.
We found that @hellocoop/better-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.

Research
/Security News
Three compromised Rust crates pulled in a malicious dependency that downloaded and executed cross-platform malware during Cargo builds.

Research
/Security News
Socket uncovered 77 linked Firefox extensions, including 40 that steal wallet secrets or credentials and 37 deceptive sports-score shells.