T
T
TTXSTM2022-03-22 22:18:23
Java
TTXSTM, 2022-03-22 22:18:23

Why does DonationAlerts return 'Unauthenticated.' JAVA?

Tried to connect to the DonationAlerts API but it outputs 'Unauthenticated.'

public static void main(String[] args) throws Exception {
        String API = "API_TOKEN";
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://www.donationalerts.com/api/v1/alerts/donations"))
                .header("Authorization", "Bearer " + API)
                .method("GET", HttpRequest.BodyPublishers.noBody())
                .build();
        HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());

    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TTXSTM, 2022-03-23
@TTXSTM

I found the answer to my question "Why does DonationAlerts return 'Unauthenticated.' Java?" I found the same question but in Python, I realized that I need to get code, token. If someone also needs help with this issue, then here is another question on this topic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question