A lightweight authentication server built with Deno and OpenAuth.
This is a minimal auth server implementation designed to be easily forked and customized for your authentication needs. It leverages OpenAuth for OAuth2 workflows and runs on Deno Deploy for a modern, secure runtime environment.
This auth server can easily be deployed to Deno Deploy by following these steps:
- Fork this repository
- Clone your fork locally
- Go to Deno Deploy and create a new project.
- Choose your fork in the GitHub repos list.
- Make sure to check "Just link the repo, I’ll set up GitHub Actions myself" as the Actions workflow is already in the repo.
- In your settings, add the required environment variables.
CLIENT_ID: The client ID for the auth server. Used to authenticate requests provenence.GITHUB_CLIENT_ID: The client ID for the GitHub authentication provider.GITHUB_CLIENT_SECRET: The client secret for the GitHub authentication provider.
To actually deploy the application, deploy deploy needs a new push to the main branch to trigger the Actions workflow. This can simply be your configuration changes.
The server is configured through the config.ts file at the project root.
Currently, the configurable options are:
allowedOrigins: An array of allowed origins. Supports wildcards for subdomains and ports.title: The title of the auth server. Shown on the home page.description: The description of the auth server. Shown on the home page.
Example configuration:
export default defineConfig({
title: "My Auth Server",
description: "A custom authentication server",
allowedOrigins: [
"http://localhost:*/",
"https://yourdomain.com",
"https://*.yourdomain.com/",
],
})You can optionnally link a custom domain name to your auth server in your Deploy settings. Everything will work normally.
Run it locally
- Deno installed on your system
Development mode with hot reload:
deno task devProduction build:
deno task build
deno task startconfig.ts- Main configuration filesrc/main.ts- Application entry pointsrc/issuer.ts- OpenAuth issuer implementation.env- Environment variables (create your own)
This project is designed to be forked and customized. Feel free to modify it according to your specific authentication requirements.