Skip to content

Obtaining access‐token

ProTerUga edited this page Jul 17, 2026 · 4 revisions

How to get an access-token?

This guide walks you through the process of obtaining an access token for DonationAlerts and connecting the plugin to your account. If you already have a valid access token, you can simply place it in the config.yml file and run /daapi reload.

Prerequisites

  • A DonationAlerts account
  • Your Minecraft server running with the plugin installed
  • Access to the server console or operator permissions

1. Create a DonationAlerts Application

First, you need to register an OAuth2 application on DonationAlerts.

  1. Go to DonationAlerts Applications.
  2. Click Create new app.
  3. Fill in the form:
image1
  • App name - any name you like (e.g., MyMinecraftPlugin).
  • Redirect URL - exactly as specified in your plugin's config.yml. (By default, it's http://localhost:8080/callback, but you can change it if needed.)
image2
  1. Click CREATE

After creation, you will see your App ID and API Key (also called Client Secret). image3

2. Configure the Plugin

Open your config.yml file and fill in the following fields:

access-token: ""   # leave empty for now

client-id: "YOUR_APP_ID"
client-secret: "YOUR_API_KEY"
  • client-id – paste the App ID from your DonationAlerts application.
  • client-secret – paste the API Key (Client Secret).

! Never share your client-secret or access-token with anyone. After saving the file, reload the plugin:

/daapi reload

3. Request an Authorization Code

Now you need to generate a one‑time authorization code.

  1. In-game or in the console, run: /daapi auth
image4
  1. The plugin will display a clickable URL in the chat (or console).
image5 image6
  1. You will be redirected to DonationAlerts.
image7
  1. After granting access, you will be redirected to the Redirect URL you set earlier.
image8
  1. Copy that entire code - it is your temporary authorization code.
image9

! The authorization code is short‑lived. If it expires, you must repeat this step.

4. Exchange the Code for an Access Token

Now exchange the authorization code for a permanent access token.

  1. In the server console (or in-game with operator permissions), run:
daapi token YOUR_AUTHORIZATION_CODE

(Replace YOUR_AUTHORIZATION_CODE with the actual code you copied.)

image10
  1. The plugin will exchange the code for an access token, automatically save it to your config.yml, and establish a connection.
image11
  1. Verify the connection:
/daapi status
image12

You should see:

image13

Your access token is now stored in config.yml. Never share it or commit it to version control.

Now your plugin is ready to receive real‑time donation alerts. 🎉

Common errors

Error: Authorization code has expired

[ERROR] [DonationAlertsAPI] Token exchange error (response 400):
{"error":"invalid_request","error_description":"The request is missing ...","hint":"Authorization code has expired"}

Cause: The temporary code you used expired (it's valid for ~10 minutes). Fix: Repeat Step 3 and Step 4 to get a fresh code.

Clone this wiki locally