Skip to main content

Auth0

Create an API with Auth0 authentication

The Auth0 resource helps you authenticate and authorize your API users with JSON Web Token (JWTs) access tokens.

This resource is great for protecting API endpoints that are used in applications where your end-users log in.

Set up your Auth0 account

  1. Go to auth0.com and create an account
  2. In the dashboard, go to Applications > APIs > Create API and create an API resource
  3. Take note of the API Audience of the new API resource
  4. Navigate to Applications > Applications and click into the new Machine to Machine test application that was created.
  5. Take note of the Domain, Client ID, and Client Secret

You should now have the pieces you need to create a Sparky Auth0 resource. You will need to continue setting up your Auth0 account based on the requirements of your application.

Connecting to Auth0

  1. In Sparky, go to app.sparky.codes/resources/new/auth0
  2. Enter the connection details you gathered above and create a new Auth0 resource

Auth0 connection fields

  1. When creating a new endpoint, configure Auth0 for that endpoint by selecting your Auth0 resource under the Auth step.

Auth0 endpoint step

  1. (Optional) Configure your Auth0 application to issue JWT tokens with scopes. Add the required scopes to each endpoint within Sparky. If configured, Sparky will verify that the user's token posesses the scopes required on the endpoint.

Calling APIs protected with Auth0

Add the bearer token to the Authorization header using this format: Bearer <your token>