Authentication is required for users to access v1 API features like URL management, API key creation, and private statistics.
JWT Configuration
JWT tokens are used to authenticate users after they log in via OAuth or other methods.Generate RSA Key Pair
You’ll need to generate an RSA key pair for signing and verifying JWT tokens.1
Generate Private Key
Generate a 2048-bit RSA private key:
2
Generate Public Key
Extract the public key from the private key:
3
View Keys
Display the keys in a format suitable for environment variables:
Configure JWT Environment Variables
Add the following to your.env file:
OAuth Configuration
Spoo.me supports three OAuth providers: Google, GitHub, and Discord. You can enable one or all of them.Google OAuth
1
Create Google Cloud Project
- Go to Google Cloud Console
- Create a new project (or select an existing one)
- Click Create Project and give it a name (e.g., “Spoo.me OAuth”)
2
Enable Google+ API
- In the left sidebar, go to APIs & Services → Library
- Search for “Google+ API”
- Click Enable
3
Configure OAuth Consent Screen
- Go to OAuth consent screen in the left sidebar
- Select External (or Internal if using Google Workspace)
- Fill in the required information:
- App name: Your app name (e.g., “Spoo.me”)
- User support email: Your email
- Developer contact: Your email
- Add authorized domains:
- For local dev:
localhostand127.0.0.1 - For production: Your domain (e.g.,
yourdomain.com)
- For local dev:
- Click Save and Continue
4
Create OAuth Credentials
- Go to Credentials in the left sidebar
- Click Create Credentials → OAuth 2.0 Client ID
- Select Web application
- Add Authorized redirect URIs:
- Click Create
- Copy the Client ID and Client Secret
5
Add to Environment Variables
GitHub OAuth
1
Create GitHub OAuth App
- Go to GitHub Developer Settings
- Click New OAuth App
- Fill in the application details:
- Application name: Your app name (e.g., “Spoo.me”)
- Homepage URL:
- Local:
http://127.0.0.1:8000orhttp://localhost:8000 - Production:
https://yourdomain.com
- Local:
- Authorization callback URL:
- Local:
http://127.0.0.1:8000/oauth/github/callback - Production:
https://yourdomain.com/oauth/github/callback
- Local:
- Click Register application
2
Get Credentials
- Copy the Client ID
- Click Generate a new client secret
- Copy the Client Secret (you won’t be able to see it again)
3
Add to Environment Variables
Discord OAuth
1
Create Discord Application
- Go to Discord Developer Portal
- Click New Application
- Give it a name (e.g., “Spoo.me”)
- Click Create
2
Configure OAuth2
- Go to the OAuth2 section in the left sidebar
- Click Add Redirect under Redirects
- Add your redirect URIs:
- Click Save Changes
3
Get Credentials
- In the OAuth2 section, copy the Client ID
- Click Reset Secret to generate a new client secret
- Copy the Client Secret
4
Add to Environment Variables
Complete Environment Configuration
Here’s a complete example.env configuration with all authentication settings:
Testing Authentication
After configuration, test the authentication flow:1
Start Your Application
2
Access Login Page
Navigate to
http://127.0.0.1:8000/login in your browser3
Test OAuth Login
Click on any OAuth provider button (Google, GitHub, or Discord) and complete the authentication flow
4
Verify Dashboard Access
After successful login, you should be redirected to the dashboard at
http://127.0.0.1:8000/dashboardTroubleshooting
OAuth redirect URI mismatch
OAuth redirect URI mismatch
Error:
redirect_uri_mismatch or invalid_redirect_uriSolution:- Ensure the redirect URI in your OAuth provider settings exactly matches the one in your
.envfile - Check for trailing slashes (some providers are strict about this)
- Use
http://for local development andhttps://for production
JWT verification failed
JWT verification failed
Error:
Invalid token or Token verification failedSolution:- Ensure your
JWT_PRIVATE_KEYandJWT_PUBLIC_KEYare correctly formatted with\nfor newlines - Verify that both keys are from the same RSA key pair
- Check that
JWT_ISSUERandJWT_AUDIENCEmatch in your configuration
Cookie not being set
Cookie not being set
OAuth provider not appearing
OAuth provider not appearing
Error: OAuth buttons not showing on login pageSolution:
- Verify that all three environment variables for the provider are set (CLIENT_ID, CLIENT_SECRET, REDIRECT_URI)
- Check application logs for any configuration errors
- Restart the application after updating
.envfile

