Credentials
Set up environment variables for your Discord Activity
Credentials authenticate your activity with Discord. Store them as environment variables (configuration values stored outside your code in a .env file, keeping secrets like passwords out of your source files) which Robo.js loads automatically at startup.
Required Variables
| Variable | Description | Where to Find |
|---|---|---|
DISCORD_CLIENT_ID | Application ID | General Information tab |
VITE_DISCORD_CLIENT_ID | Same value, exposed to frontend | Same as above |
DISCORD_CLIENT_SECRET | OAuth2 client secret | OAuth2 tab |
Client ID
Find the application ID in the Discord Developer Portal under General Information.
Discord Developer Portal General Information tab with the Application ID field highlighted, showing the copy button next to the ID
Add it to your .env file:
# .env
DISCORD_CLIENT_ID="your_application_id"
VITE_DISCORD_CLIENT_ID="your_application_id"Vite only exposes environment variables prefixed with VITE_ to client-side code. The backend uses DISCORD_CLIENT_ID (accessible via process.env), while the frontend uses VITE_DISCORD_CLIENT_ID (accessible via import.meta.env). Both must be set to the same value — without the VITE_ prefixed version, your frontend code cannot read the client ID.
Client Secret
Find the client secret in the Discord Developer Portal under the OAuth2 tab. You may need to click Reset Secret to reveal it.
Discord Developer Portal OAuth2 tab showing the Client Secret section with the Reset Secret button
Add it to your .env file:
# .env
DISCORD_CLIENT_SECRET="your_client_secret"Redirect URI
Activities handle authentication through the Embedded App SDK rather than browser redirects. Discord's Developer Portal requires at least one redirect URI to be set — enter https://localhost as a placeholder.
Security
Your .env file should be listed in .gitignore to prevent it from being committed to version control. Projects scaffolded with create-robo include .env in .gitignore by default.
Never commit your client secret. If exposed, regenerate it immediately in the Discord Developer Portal.
