Skip to main content

πŸ”‘ Discord Activity Credentials

For your Discord Activity to work, you need to set up a few environment variables to authenticate with Discord.

These are secret values that you should never share with anyone. They're stored in a .env file, which is automatically loaded by Robo.js when you start your project.

Looking to authenticate users? See Authentication instead.

What You Need​

Get the following environment variables from the Discord Developer Portal.

Client ID​

This is your Discord Application ID, found in the Discord Developer Portal. Sign in with your Discord account, click on your bot application, and find the Application ID in the General Information tab.

Discord Application ID

In your .env file, add the following line:

.env
DISCORD_CLIENT_ID="your_application_id"
VITE_DISCORD_CLIENT_ID="your_application_id"
info

The VITE_ variant is required for client-side access. Do not delete it!

Client Secret​

This is your Discord Client Secret, found in the OAuth2 tab of your app. You may need to reveal it by clicking Reset Secret.

Discord Client Secret

In your .env file, add the following line:

.env
DISCORD_CLIENT_SECRET="your_client_secret"
Reminder

Don't forget to replace your_client_secret with the value you just obtained!

Redirect URI​

Even though redirect uris aren't used in Discord Activities, you still need to set one up in the OAuth2 tab of your app.

Discord Redirect URI

This can be any valid URL, such as:

https://robojs.dev/
note

You still need to set it to something even if it's not used by Discord!

Keep It Secure​

Make sure to keep your .env file safe and never share it with anyone. If you accidentally expose your credentials, you can regenerate them in the Discord Developer Portal.

Remember to add .env to your .gitignore file to prevent it from being pushed to your repository.

.gitignore
.env

Don't worry, Robo.js will automatically load your environment variables when you start your project.

Robo.js Logo

MIT Β© 2024 Robo.js By WavePlay