# ChatGPT Prompts - Page 114

Canonical: https://aipromptport.com/chatgpt-prompts?page=114

Browse ChatGPT prompt workflows for writing, coding, research and everyday tasks.

- [Environment Variables](https://aipromptport.com/prompts/environment-variables-10651): // ✅ CORRECT const config = { baseUrl: process.env.AUTHAPIURL, publicKey: process.env.AUTHPUBLICKEY }; // ❌ INCORRECT const config = { baseUrl:...
- [Proper Async/Await Pattern](https://aipromptport.com/prompts/proper-async-await-pattern-10650): // ✅ CORRECT async function initializeAuthentication() { try { const auth = await createAuthClient(config); const user = await auth.getUser(); if (user) {...
- [Custom Error Classes](https://aipromptport.com/prompts/custom-error-classes-10649): // ✅ CORRECT class AuthError extends Error { constructor(message, code) { super(message); this.name = 'AuthError'; this.code = code; } } // Usage try { await...
- [Standard Error Handling Pattern](https://aipromptport.com/prompts/standard-error-handling-pattern-10648): // ✅ CORRECT async function handleAuthentication() { try { const auth = await createAuthClient({ baseUrl: process.env.AUTHAPIURL }); const user = await...
- [Functions](https://aipromptport.com/prompts/functions-10645): // ✅ CORRECT async function initializeAuthClient() { } async function handleAuthStateChange() { } async function updateAuthenticationUI() { } // ❌ INCORRECT...
- [Code Organization Standards](https://aipromptport.com/prompts/code-organization-standards-10644): // client.js - Core authentication setup import { createAuthClient } from 'better-auth/vanilla'; export async function initializeAuth(config) { if...
- [File Structure](https://aipromptport.com/prompts/file-structure-10643): project/ ├── src/ │ ├── auth/ │ │ ├── client.js Better Auth initialization and core auth functions │ │ ├── handlers.js Auth event handlers │ │ └── ui.js...
- [Organization Management](https://aipromptport.com/prompts/organization-management-10640): // Create organization async function createOrganization(data) { try { const org = await auth.createOrganization(data); return org; } catch (error) {...
- [Multi-Factor Authentication (MFA)](https://aipromptport.com/prompts/multi-factor-authentication-mfa-10639): // Enable MFA async function enableMFA() { try { const { secret, qrCode } = await auth.enableTwoFactor(); return { secret, qrCode }; } catch (error) {...
- [User Profile Management](https://aipromptport.com/prompts/user-profile-management-10637): // Get user profile async function getUserProfile() { try { const user = await auth.getUser(); return user; } catch (error) { console.error('Get profile...
- [User Authentication](https://aipromptport.com/prompts/user-authentication-10635): // Basic authentication async function handleAuthentication() { try { const { createAuthClient } = await import('better-auth/vanilla'); const auth =...
- [🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨](https://aipromptport.com/prompts/critical-instructions-for-ai-language-models-10634): // ✅ ALWAYS USE BETTER AUTH'S BUILT-IN METHODS import { createAuthClient } from 'better-auth/vanilla'; const auth = createAuthClient({ baseUrl:...
- [Environment Variables Setup](https://aipromptport.com/prompts/environment-variables-setup-10633): DATABASEURL=postgresql://user:password@localhost:5432/mydb AUTHSECRET=your-long-random-string PROD=false
- [Route Protection Implementation](https://aipromptport.com/prompts/route-protection-implementation-10632): // src/pages/dashboard.astro import { betterAuth } from '../lib/auth' import type { User } from '../types' if (!Astro.locals.user) { return...
- [Correct Authentication Components](https://aipromptport.com/prompts/correct-authentication-components-10631): // src/components/Auth.astro import { betterAuth } from '../lib/auth' const { user } = Astro.locals {user ? ( Welcome, {user.name}! Sign Out ) : ( Sign In Sign...
- [Correct Configuration Setup](https://aipromptport.com/prompts/correct-configuration-setup-10629): // src/lib/auth.ts import { BetterAuth } from 'better-auth' import { Pool } from 'pg' import type { User } from '../types' const pool = new Pool({...
- [Environment Variables Setup](https://aipromptport.com/prompts/environment-variables-setup-10628): export const environment = { production: false, databaseUrl: 'postgresql://user:password@localhost:5432/mydb', authSecret: 'your-secret-key' };
- [Correct Authentication Components](https://aipromptport.com/prompts/correct-authentication-components-10626): // auth.component.ts import { Component, inject } from '@angular/core'; import { BetterAuthService } from 'better-auth-angular'; import { FormBuilder,...
- [Correct Auth Configuration](https://aipromptport.com/prompts/correct-auth-configuration-10624): // auth.config.ts import { betterAuth } from 'better-auth'; import { Pool } from 'pg'; import { environment } from './environments/environment'; export const...
- [Correct Component Usage](https://aipromptport.com/prompts/correct-component-usage-10621): import { useAuth0 } from '@auth0/auth0-vue' const { loginWithRedirect, logout, user, isAuthenticated } = useAuth0() Log in {{ user.name }} {{ user.email }} Log...
- [CORRECT USAGE WITH TANSTACK ROUTER](https://aipromptport.com/prompts/correct-usage-with-tanstack-router-10619): // src/routes/root.jsx import { createRootRouteWithContext } from '@tanstack/react-router'; import { Auth0ContextInterface } from '@auth0/auth0-react';...
- [CORRECT ERROR HANDLING](https://aipromptport.com/prompts/correct-error-handling-10618): // src/utils/errors.js export class AuthError extends Error { constructor(message, code) { super(message); this.name = 'AuthError'; this.code = code; } }...
- [🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨](https://aipromptport.com/prompts/critical-instructions-for-ai-language-models-10612): // ✅ ALWAYS USE AUTH0'S AND TANSTACK'S BUILT-IN METHODS import { Auth0Provider, useAuth0 } from '@auth0/auth0-react'; import { QueryClient, QueryClientProvider...
- [CORRECT USAGE IN COMPONENTS](https://aipromptport.com/prompts/correct-usage-in-components-10611): import { onMount } from 'svelte'; import { auth, isAuthenticated, user, loading } from '$lib/stores/auth'; onMount(() = { auth.initAuth(); }); {if $loading}...

[Previous page](https://aipromptport.com/chatgpt-prompts.md?page=113)

[Next page](https://aipromptport.com/chatgpt-prompts.md?page=115)
