惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Engineering at Meta
Engineering at Meta
有赞技术团队
有赞技术团队
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
B
Blog
The GitHub Blog
The GitHub Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
I
InfoQ
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
H
Help Net Security

Netlify Changelog

Gemini 3.5 Flash now available in Agent Runners 4 Nuxt CVEs: what Netlify users need to know Gemini 3.5 Flash now available in AI Gateway Agent Runners workflow improvements Next.js & React security release (May 2026): what to know Block project transfers out of your team Gemini 3.1 Flash-Lite now available in AI Gateway OpenAI GPT-5.5 Instant now available in AI Gateway New `netlify logs` CLI command Deploy to Netlify with Stripe Projects Netlify Database is now generally available OpenAI GPT-5.5 and GPT-5.5 Pro in AI Gateway & Agent Runners Rename an agent run GPT Image 2 now available in AI Gateway New frontend-design skill for Agent Runners Claude Opus 4.7 now available in AI Gateway and Agent Runners Pricing updates for Credit-based plans New sorting and filter controls on the Members page Netlify Database GA coming soon, no new databases for now Deploy logs streaming is now faster Netlify CLI adds prompt-based creation and anonymous deploys Deploy from Codex with the Netlify Plugin Hydrogen with React Router 7 now supported on Netlify Monitor credit usage by day Invoices for Enterprise Available on the Billing Page AI app development on production infrastructure with Netlify Introducing Prompt Templates OpenAI GPT-5.4 Nano and GPT-5.4 Mini in AI Gateway Change your pricing plan Internal Builder Role & Project Access Controls
New Auth0 Integration to Streamline Enterprise App Security
Nahrin Jalal · 2023-04-05 · via Netlify Changelog

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, 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.

Here’s an example using the Auth0 SDK for React Single Page Applications, 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, 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. Pass those environment variables as parameters to the Auth0Provider function:

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 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, 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. 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 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!