{"id":24904,"library":"amplify-auth-hooks","title":"Amplify Auth Hooks","description":"React hooks for AWS Amplify authentication. Version 1.0.0 provides a set of hooks like useAuth, useSignIn, useSignUp, etc., wrapping Amplify Auth operations. Released as a single version with no updates since. Differentiates by offering hook-based API for Amplify Auth, tightly coupled with React lifecycle. Requires @aws-amplify/auth, @aws-amplify/core, amazon-cognito-identity-js, and react as peer dependencies. Ships TypeScript types.","status":"maintenance","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/hupe1980/amplify-material-ui","tags":["javascript","react","aws amplify","amplify","hooks","auth","typescript"],"install":[{"cmd":"npm install amplify-auth-hooks","lang":"bash","label":"npm"},{"cmd":"yarn add amplify-auth-hooks","lang":"bash","label":"yarn"},{"cmd":"pnpm add amplify-auth-hooks","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for Auth API","package":"@aws-amplify/auth","optional":false},{"reason":"Required for configuration","package":"@aws-amplify/core","optional":false},{"reason":"Underlying Cognito library","package":"amazon-cognito-identity-js","optional":false},{"reason":"Peer dependency for hooks","package":"react","optional":false}],"imports":[{"note":"Named export, not default.","wrong":"import useAuth from 'amplify-auth-hooks'","symbol":"useAuth","correct":"import { useAuth } from 'amplify-auth-hooks'"},{"note":"CommonJS require works, but prefer ESM.","wrong":"const { useSignIn } = require('amplify-auth-hooks')","symbol":"useSignIn","correct":"import { useSignIn } from 'amplify-auth-hooks'"},{"note":"Hook name is useSignUp, not SignUp.","wrong":"import { SignUp } from 'amplify-auth-hooks'","symbol":"useSignUp","correct":"import { useSignUp } from 'amplify-auth-hooks'"}],"quickstart":{"code":"import React from 'react';\nimport { useAuth } from 'amplify-auth-hooks';\n\nfunction AuthStatus() {\n  const { user, loading, error } = useAuth();\n\n  if (loading) return <div>Loading...</div>;\n  if (error) return <div>Error: {error.message}</div>;\n  if (user) return <div>Welcome, {user.username}</div>;\n  return <div>Not logged in</div>;\n}\n\nexport default AuthStatus;","lang":"typescript","description":"Shows basic usage of useAuth hook to get authentication state."},"warnings":[{"fix":"Call Amplify.configure() once at app root.","message":"Forgot to configure Amplify before using hooks","severity":"gotcha","affected_versions":"*"},{"fix":"Use loading state to handle asynchronous auth check.","message":"Undefined user on first render","severity":"gotcha","affected_versions":"*"},{"fix":"Upgrade to latest version for hooks support.","message":"Old version only supports class components?","severity":"deprecated","affected_versions":"<=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"import Amplify from '@aws-amplify/core'; Amplify.configure(awsConfig);","cause":"Amplify not configured or imported","error":"Cannot read property 'amplify' of undefined"},{"fix":"import { useAuth } from 'amplify-auth-hooks';","cause":"Wrong import (default vs named)","error":"TypeError: (0 , _auth.useAuth) is not a function"},{"fix":"Use ES module import syntax.","cause":"Using CommonJS require in browser bundle","error":"Uncaught ReferenceError: require is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}