---
title: "New Auth0 Integration to Streamline Enterprise App Security"
description: "Enhance enterprise application security with the Netlify and Auth0 integration. Streamline access management across integrated services and safeguard your data."
source: "https://www.netlify.com/blog/auth0-integration/"
last_updated: "2026-07-10T22:27:32.000Z"
---
Securing access between services is a critical issue for enterprises, because it involves managing access to multiple integrated applications and services that need to communicate and share data with each other to perform their functions. For organizations that rely on multiple integrated applications and services to provide complete solutions, such as web applications that communicate with databases, APIs, and more, secure access management is crucial. Mismanaged access can lead to severe issues like data breaches, service disruptions, inefficient operation, and even compliance violations.

With our newest [integration (beta) with Auth0 by Okta](https://www.netlify.com/integrations/auth0/), developers can benefit from a streamlined and secure solution for managing access across multiple services, which can be valuable for enterprises and organizations with complex application and service architectures involving multiple teams and departments. The integration enables Netlify users to automatically link their sites to Applications and APIs on Okta, and add authorization to Netlify Functions using the `withAuth0` method to build SaaS applications on Netlify.

## Using Auth0 in your frontend application

_Information below is just a slice of the integration. For detailed guidance on setting up your Auth0 application, a tenant, and a Netlify site to configure with an Auth0 app, please refer to our [docs page](https://docs.netlify.com/integrations/auth0-by-okta-integration/)._

Here’s an example using the [Auth0 SDK for React Single Page Applications](https://auth0.github.io/auth0-react/), which provides a wrapper for your application. In this example, the prefix `VITE_` is used for the environment variables.

You might recall that when you [established your connection](https://docs.netlify.com/integrations/auth0-by-okta-integration/#connect-to-auth0/), you added your Auth0 client ID and domain. Prefixed with the build system of your choice, this created the `AUTH0_CLIENT_ID` and `AUTH0_DOMAIN` environment variables. You created the `AUTH0_AUDIENCE` environment variable when you [configured your tenant](https://docs.netlify.com/integrations/auth0-by-okta-integration/#configure-your-tenant). Pass those environment variables as parameters to the [Auth0Provider function](https://auth0.github.io/auth0-react/functions/Auth0Provider.html):

```
import { Auth0Provider } from "@auth0/auth0-react";import React from "react";import ReactDOM from "react-dom/client";import App from "./App";import "./index.css";
{% raw %}ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(  <React.StrictMode>    <Auth0Provider      clientId={import.meta.env.VITE_AUTH0_CLIENT_ID}      domain={import.meta.env.VITE_AUTH0_DOMAIN}      authorizationParams={{        redirect_uri: window.location.origin,        audience: import.meta.env.VITE_AUTH0_AUDIENCE,        scope: "openid profile admin",      }}    >      <App />    </Auth0Provider>  </React.StrictMode>);{% endraw %}
```

## Create a function to use Auth0 on the backend

You can use the Auth0 by Okta Integration to add authorization to a [serverless function](https://docs.netlify.com/functions/overview/) in your project.

To get started, install the necessary packages:

```
npm install @netlify/auth0 @netlify/integrations
```

The example uses `withAuth0` alongside another integration, `withPlanetscale`, which enables a database call to get users. This method requires the [PlanetScale Integration](https://docs.netlify.com/integrations/planetscale-integration/), so install the following package as well:

```
npm install @netlify/planetscale
```

In the example below, the `withAuth0` hook is passed into the `wrap` method that wraps the handler function. The `required` parameter is set to `true`, ensuring authentication is required. By default, this parameter is set to `false`.

The `roles` property is an optional configuration to use [RBAC](https://auth0.com/docs/manage-users/access-control/rbac). For this use case, a user must authenticate and possess the `admin` role in order to access the users pulled from the database. You need to [configure permissions for roles](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/roles/add-permissions-to-roles) in your Auth0 dashboard.

```
import { Handler } from "@netlify/functions";import { wrap } from "@netlify/integrations";import { withPlanetscale } from "@netlify/planetscale";import { withAuth0 } from "@netlify/auth0";
const withIntegrations = wrap(withAuth0, withPlanetscale);
export const handler: Handler = withIntegrations(  async (event, context) => {    const { connection } = context.planetscale;
    const { rows: users } = await connection.execute("SELECT * FROM  users");
    return {      statusCode: 200,      body: JSON.stringify(users),    };  },  {    auth0: {      required: true,      roles: ["admin"],    },  });
```

If you have any questions or feedback about this integration, feel free to post in our [forums](https://answers.netlify.com/?_gl=1*erynin*_gcl_aw*R0NMLjE2Nzk2MTAxMTYuQ2owS0NRanc4ZS1nQmhEMEFSSXNBSmlEc2FWMnluUExWSXBXcld3RnRmNEhSWUxWVWRtVWdRVEFFWjd3Wi1kUDY2dGNWRm5VQ1ZYOWRlZ2FBbnh2RUFMd193Y0I.)!

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=New Auth0 Integration to Streamline Enterprise App Security&url=https://www.netlify.com/blog/auth0-integration/)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2Fauth0-integration%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/auth0-integration/)
-   [Bluesky](https://bsky.app/intent/compose?text=New Auth0 Integration to Streamline Enterprise App Security+https://www.netlify.com/blog/auth0-integration/)

* * *

### Tags

-   [changelog](/blog/tags/changelog/)
-   [Authentication](/blog/tags/authentication/)
-   [Integrations](/blog/tags/integrations/)

## Keep reading

![](/_astro/eb275ddb9290b947ba4c53ac30538c77b44edae9-720x405_1y2MXK.webp)

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

![](/_astro/d20f9f717bbdd511f73ee138be4114ff13f480f9-2400x1350_1fe4aq.webp)

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

## Recent posts

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)