Skip to content

This repository provides a template for implementing OAuth authentication using the AT Protocol. It includes a shell setup for handling login functionality, a logged-in state, and interactions with a database.

License

Notifications You must be signed in to change notification settings

samsour/atproto-oauth-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AT Protocol OAuth Start

An example application covering:

  • Signin via OAuth
  • Fetch user profile data
  • Persistent session storage with SQLite

Installation

git clone https://github.com/samsour/atproto-oauth-starter.git

cd atproto-oauth-starter

# Create .env file with your configuration
cp .env.example .env

npm install
npm run dev

# Navigate to http://localhost:8080

Environment Variables

Create a .env file in the root directory with the following variables:

NODE_ENV="development" # Options: 'development', 'production'
PORT="8080"            # The port your server will listen on
HOST="localhost"       # Hostname for the server
PUBLIC_URL=""          # Set when deployed publicly, e.g. "https://mysite.com". Informs OAuth client id.
DB_PATH=":memory:"     # The SQLite database path. Leave as ":memory:" to use a temporary in-memory database.

# Secrets
# Must set this in production. May be generated with `openssl rand -base64 33`
# COOKIE_SECRET=""

Environment Variable Details

  • NODE_ENV: Set to "development" for local development or "production" for production deployment
  • PORT: The port number your server will listen on (default: 8080)
  • HOST: The hostname for your server (default: localhost)
  • PUBLIC_URL: Set this when deploying publicly. Used to generate the OAuth client ID
  • DB_PATH: Path to your SQLite database. Use ":memory:" for temporary in-memory storage
  • COOKIE_SECRET: Required in production. Generate with openssl rand -base64 33

About

This repository provides a template for implementing OAuth authentication using the AT Protocol. It includes a shell setup for handling login functionality, a logged-in state, and interactions with a database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published