1. 10
    Configure Fauna to Authenticate with Auth0 in a Next.js Application
    2m 15s

Configure Fauna to Authenticate with Auth0 in a Next.js Application

Shadid Haque
InstructorShadid Haque
Share this video with your friends

Social Share Links

Send Tweet
Published 2 years ago
Updated 2 years ago

Now that we have login working, we'll need to configure Fauna with Auth0 to give logged in vendors more permissions than logged out users.

We'll start by creating a role that includes creating, updating, and deleting data in our database. In the provider tab, we'll create an access provider and set issuer and JWKS urls that we got from Auth0. This will create an Audience URL that we will set in Auth0 and Next.js.

Shadid Haque: [0:00] Let's configure Fauna for Auth0. We want authenticated users to be able to create, delete, and update records in our database. Let's go ahead and create a new role for that. We're going to call this role AuthRole. Let's give create, update, and delete permission to both Shop and Product collection.

[0:19] Next, we'll go to Security and go to the provider tab. We'll create a new access provider for Auth0. Let's name this Auth0. We'll go back to our code, and from our environment variable, we're going to get the issuer URL. Make sure you add a trailing backslash here.

[0:56] For the JWKS endpoint, we are going to paste the issuer URL and then backslash and then .well-known and then backslash and we're going to write jwks.json. That's going to be our JWKS endpoint.

[1:17] Next, we're going to select a role. Let's go ahead and select our Auth0 role. We're going to copy this audience URL, and we're going to go back to our code.

[1:31] In our environment variable, we're going to create a new environment variable. We're going to call it AUTH0_AUDIENCE and paste in that audience URL. Let's go back to Fauna dashboard and save everything.

[1:45] Next, we will go back to Auth0 dashboard. From here, we're going to select APIs, and we're going to select Create API. We're going to give our API a name. For Identifier, we will paste in the audience URL from Fauna. Finally, we'll select Create. Now, we have successfully configured Fauna to work with Auth0.

egghead
egghead
~ 19 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today