LogoRobo.js

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

VariableDescriptionWhere to Find
DISCORD_CLIENT_IDApplication IDGeneral Information tab
VITE_DISCORD_CLIENT_IDSame value, exposed to frontendSame as above
DISCORD_CLIENT_SECRETOAuth2 client secretOAuth2 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

FocusThe Application ID field and copy button on General Information tabZoom100%NotesShow the Developer Portal General Information tab. Highlight the Application ID field. The application name should be visible at the top.

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

FocusThe Client Secret field and Reset Secret button on the OAuth2 tabZoom100%NotesShow the OAuth2 tab. Focus on the Client Secret section with 'Reset Secret' button visible. Secret either obscured or freshly revealed.

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.

Next Steps

On this page