SDKs overview

Auth0 provides Software Development Kits (SDKs) to facilitate the integration of its authentication and authorization services into various application types and platforms. These SDKs are designed to abstract underlying OAuth 2.0 and OpenID Connect protocol details, allowing developers to implement features like user login, registration, and profile management with fewer lines of code. The ecosystem includes official SDKs maintained by Auth0 and community-contributed libraries.

The SDKs support a range of authentication flows. For client-side applications (e.g., single-page applications, mobile apps), SDKs typically implement the Authorization Code Flow with Proof Key for Code Exchange (PKCE) for enhanced security. Server-side applications often utilize the standard Authorization Code Flow or Client Credentials Flow for machine-to-machine communication. Auth0 authentication flow guides detail these implementations.

Developers can integrate Auth0 SDKs to manage user sessions, handle token lifecycle (issuance, refresh, revocation), and secure API access. Many SDKs also offer helper methods for integrating with Auth0's Universal Login experience, which provides a hosted and customizable login page. Auth0 Universal Login documentation offers further information.

Official SDKs by language

Auth0 maintains official SDKs and libraries across various programming languages and frameworks. These SDKs are actively developed and supported to ensure compatibility with Auth0's platform features and security standards. The following table lists key official SDKs:

Language / Framework Package Name(s) Typical Installation Command Maturity / Use Cases
Node.js (Backend) auth0-node npm install auth0-node or yarn add auth0-node Production-ready for server-side applications, API protection.
Python (Backend) python-auth0 pip install python-auth0 Production-ready for web frameworks like Django, Flask.
Ruby (Backend) auth0 gem install auth0 Production-ready for Rails and other Ruby applications.
PHP (Backend) auth0/auth0-php composer require auth0/auth0-php Production-ready for Laravel, Symfony, and general PHP projects.
Java (Backend) auth0-java Maven / Gradle dependency (e.g., com.auth0:auth0:3.x.x) Production-ready for Spring Boot, Java EE applications.
C# (.NET Backend) Auth0.NET dotnet add package Auth0.NET Production-ready for ASP.NET Core and other .NET applications.
Go (Backend) go-auth0 go get github.com/auth0/go-auth0 Production-ready for Go microservices and web servers.
Swift (iOS / macOS) Auth0.swift Swift Package Manager (via Xcode) or CocoaPods (pod 'Auth0') Production-ready for native iOS and macOS applications.
Android (Java/Kotlin) auth0-android Gradle dependency (e.g., com.auth0.android:auth0:2.x.x) Production-ready for native Android applications.
React (Frontend) @auth0/auth0-react npm install @auth0/auth0-react or yarn add @auth0/auth0-react Production-ready for single-page React applications.
Vue (Frontend) @auth0/auth0-vue npm install @auth0/auth0-vue or yarn add @auth0/auth0-vue Production-ready for single-page Vue.js applications.
Angular (Frontend) @auth0/auth0-angular npm install @auth0/auth0-angular or yarn add @auth0/auth0-angular Production-ready for single-page Angular applications.

For a comprehensive list and detailed documentation on each SDK, developers can refer to the Auth0 SDK documentation portal.

Installation

Installation methods for Auth0 SDKs vary by language and platform. Package managers are the primary method for most environments. Below are typical installation commands for common scenarios:

  • Node.js: For server-side applications, use npm or Yarn. For example, npm install auth0-node.
  • Python: Pip is used to install the Python SDK: pip install python-auth0.
  • Java: Add the SDK as a dependency in your pom.xml (Maven) or build.gradle (Gradle) file. Example Maven: <dependency><groupId>com.auth0</groupId><artifactId>auth0</artifactId><version>[latest_version]</version></dependency>.
  • Ruby: Use Bundler or Gem directly: gem install auth0.
  • PHP: Composer is the standard for PHP packages: composer require auth0/auth0-php.
  • C# (.NET): Install via NuGet Package Manager or the .NET CLI: dotnet add package Auth0.NET.
  • Go: Use go get: go get github.com/auth0/go-auth0.
  • React, Vue, Angular: For frontend frameworks, npm or Yarn are used. E.g., npm install @auth0/auth0-react for React applications.
  • Swift (iOS/macOS): Can be integrated via Swift Package Manager, CocoaPods, or Carthage.
  • Android (Java/Kotlin): Add the dependency to your app's build.gradle file.

Detailed, language-specific instructions are available on the Auth0 CLI installation and configuration pages and individual SDK documentation.

Quickstart example

This quickstart example demonstrates how to configure and use the @auth0/auth0-react SDK for a simple React application. This process generally involves wrapping your application with an Auth0Provider and using hooks for authentication status and user information.

1. Install the SDK:

npm install @auth0/auth0-react

2. Configure Auth0Provider in your main application file (e.g., index.js or main.jsx):

// src/index.js
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { Auth0Provider } from '@auth0/auth0-react';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <Auth0Provider
      domain="YOUR_AUTH0_DOMAIN"
      clientId="YOUR_AUTH0_CLIENT_ID"
      authorizationParams={{
        redirect_uri: window.location.origin
      }}
    >
      <App />
    </Auth0Provider>
  </React.StrictMode>
);

Replace YOUR_AUTH0_DOMAIN and YOUR_AUTH0_CLIENT_ID with your actual Auth0 tenant domain and application client ID, which can be found in your Auth0 Dashboard under Applications. Auth0 React quickstart guide offers specific steps.

3. Implement login/logout and display user info in a component (e.g., App.js):

// src/App.js
import React from 'react';
import { useAuth0 } from '@auth0/auth0-react';

function App() {
  const { loginWithRedirect, logout, user, isAuthenticated, isLoading } = useAuth0();

  if (isLoading) {
    return <div>Loading authentication data...</div>;
  }

  return (
    <div>
      <h1>Auth0 React Integration</h1>
      {isAuthenticated ? (
        <div>
          <h2>Welcome, {user.name}</h2>
          <p>Email: {user.email}</p>
          <button onClick={() => logout({ logoutParams: { returnTo: window.location.origin } })}>
            Log Out
          </button>
        </div>
      ) : (
        <button onClick={() => loginWithRedirect()}>Log In</button>
      )}
    </div>
  );
}

export default App;

This example demonstrates conditional rendering based on authentication status and provides buttons for login and logout functionality.

Community libraries

Beyond the official offerings, the Auth0 ecosystem includes various community-contributed libraries and integrations. These libraries often extend functionality, provide integrations with niche frameworks, or offer alternative approaches to common Auth0 use cases. While not officially supported by Auth0, many are actively maintained by their creators and can be valuable resources.

Examples of community contributions include libraries for specific web frameworks not covered by an official SDK, command-line interfaces (CLIs) for managing Auth0 tenants, and utilities for working with Auth0's management API. Developers can typically find these resources on platforms like GitHub, often linked from community forums or the Auth0 Community website.

When considering community libraries, it is advisable to evaluate their maintenance status, community activity, and compatibility with the latest Auth0 features and security standards. Reviewing the source code and understanding the underlying implementation is also recommended. For example, developers using advanced features of the OpenID Connect standard might consult the OAuth 2.0 PKCE specification for context on secure authentication flows, even when using an SDK.