This repository demonstrates how to integrate Auth0 authentication with a SvelteKit application. Auth0 provides a flexible, secure, and easy-to-use authentication and authorization platform, while SvelteKit offers a powerful framework for building web applications with Svelte.
Before you begin, ensure you have the following installed:
Clone the repository:
git clone https://github.com/arthurjgs/sveltekit-auth0-integration.git
Install dependencies:
cd auth0-sveltekit-integration
npm install
Configuration:
Copy the .env.example
file to .env
:
cp .env.example .env
Update .env
with your Auth0 credentials and settings.
Run the application:
npm run dev
This command will start the development server. Open your browser and navigate to http://localhost:5173
to view the application.
Create an Auth0 Application:
http://localhost:5173
for local development)Update Auth0 Settings in .env
.env
file with your Auth0 Domain, Client ID, and Client Secret obtained from the Auth0 Dashboard.This application provides a simple demonstration of how to integrate Auth0 authentication with SvelteKit. Users can sign up, log in, and log out using Auth0's Universal Login feature. The authentication state is managed without any SDK.
/src
: Contains the source code of the SvelteKit application./src/routes/api
: Contains the api routes for handling authentication./src/lib/auth
: Contains utility functions and Auth0 configuration.Contributions are welcome! Please feel free to submit pull requests or open issues if you encounter any problems or have suggestions for improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This README provides a basic overview of setting up Auth0 integration with SvelteKit. For more detailed information, refer to the official documentation of Auth0 and SvelteKit.