How to call default API endpoint in custom plugin?

Hi,

I have an endpoint called /api/groups created with Content-Type-Builder. Doing a axios request without authorization to this endpoint inside my plugin returns me the data because it is open for public. When doing it like the example you mentioned it returns me a 401 unauthorized and logs me out of the strapi application?

This is my call:

import React, { useState, useEffect } from 'react';
import { getFetchClient } from '@strapi/helper-plugin';
import pluginId from '../../pluginId';

const getGroups = async () => {
    try {
      const { get } = getFetchClient();
      const response = await get('/api/groups');
      console.log(response.data);
    } catch (error) {
      // Handle error scenario
    }
  };
  useEffect(() => {
    getGroups();
  }, []);

Can you or someone help me?