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.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
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”)
Enable Google+ API
- In the left sidebar, go to APIs & Services → Library
- Search for “Google+ API”
- Click Enable
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
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
GitHub OAuth
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
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)
Discord OAuth
Create Discord Application
- Go to Discord Developer Portal
- Click New Application
- Give it a name (e.g., “Spoo.me”)
- Click Create
Configure OAuth2
- Go to the OAuth2 section in the left sidebar
- Click Add Redirect under Redirects
- Add your redirect URIs:
- Click Save Changes
Get Credentials
- In the OAuth2 section, copy the Client ID
- Click Reset Secret to generate a new client secret
- Copy the Client Secret
Complete Environment Configuration
Here’s a complete example.env configuration with all authentication settings:
Testing Authentication
After configuration, test the authentication flow:Test OAuth Login
Click on any OAuth provider button (Google, GitHub, or Discord) and complete the authentication flow
Troubleshooting
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

