So what you are basically saying is that I need to use axios because I am doing the request from the Strapi Admin UI and I will be authenticated because of that. I have set the endpoint /api/groups/ only to authenticated and changed my code to this:
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import pluginId from '../../pluginId';
const getGroups = async () => {
axios.get('http://localhost:1337/api/groups')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
};
useEffect(() => {
getGroups();
}, []);
This returns me a 403 Forbidden now. So that won’t work 