AU

Auth0 React

@auth0/auth0-react

Auth0 SDK for React Single Page Applications (SPA)

Authentication
auth0
login
Authorization Code Grant Flow
PKCE
Single Page Application authentication
SPA authentication
react
@auth0/auth0-react
Authentication
javascript
Stars
367
Weekly
1.3M
Open issues
5
Bundle
~25 kB

Installation

npm install @auth0/auth0-react

Code example

import { signIn } from "@auth0/auth0-react";

export function Example() {
  return (
    <button type="button" onClick={() => signIn()}>
      Continue with Auth0 React
    </button>
  );
}

Pros & cons

Pros

  • Actively maintained by Auth0
  • 1.3M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 5 open issues on GitHub

FAQs

Alternatives & similar libraries