- pnpm
- Node 18+
- An existing Fanvue App from Fanvue Developers (client id/secret)
-
Create
.env.local
using.env.example
-
Install deps and run:
pnpm install
pnpm dev
- Visit Fanvue Developer Area
- Create a new App to obtain your Client ID and Client Secret
- Configure a Redirect URI
- Development:
http://localhost:3000/api/oauth/callback
- Production:
https://YOUR_DOMAIN/api/oauth/callback
- Development:
- Configure scopes
- For this starter, you need:
read:self
- The scopes you set in your
.env
must exactly match what you select in the Fanvue developer UI for your app - Note: The app automatically includes required system scopes (
openid
,offline_access
,offline
) in addition to what you set inOAUTH_SCOPES
- For this starter, you need:
Required variables
OAUTH_CLIENT_ID
: From your Fanvue appOAUTH_CLIENT_SECRET
: From your Fanvue appOAUTH_SCOPES
: App scopes selected in the Fanvue UI (e.g.read:self
)OAUTH_REDIRECT_URI
: Full URL to/api/oauth/callback
for your environmentSESSION_SECRET
: A random string of at least 16 charactersSESSION_COOKIE_NAME
(default:fanvue_oauth
)
These are not something you should change
OAUTH_ISSUER_BASE_URL
(default:https://auth.fanvue.com
)API_BASE_URL
(default:https://api.fanvue.com
)
Example .env.local
(development)
OAUTH_CLIENT_ID=YOUR_CLIENT_ID
OAUTH_CLIENT_SECRET=YOUR_CLIENT_SECRET
OAUTH_SCOPES=read:self
OAUTH_REDIRECT_URI=http://localhost:3000/api/oauth/callback
SESSION_SECRET=use-a-random-16-char-secret
OAUTH_ISSUER_BASE_URL=https://auth.fanvue.com
API_BASE_URL=https://api.fanvue.com
SESSION_COOKIE_NAME=fanvue_oauth
- Set the same environment variables in your hosting provider for production
- Ensure the Fanvue app has the production Redirect URI configured:
https://YOUR_DOMAIN/api/oauth/callback
- Ensure
OAUTH_SCOPES
exactly matches your selected scopes (e.g.read:self
) - Build and run
pnpm install
pnpm build
pnpm start
To deploy, we recommend using Vercel
If you need a database, Supabase should have you covered
Usage
- Visit
/
and click “Login with Fanvue” - After OAuth, your Fanvue current user JSON is shown
- Click “Logout” to clear the session
Docs
- Fanvue API: https://api.fanvue.com/docs