Hey ich habe das Problem das immer der Error kommt:

Access to fetch at 'https://api.mojang.com/user/profile/7a6b1f5a-753a-4fc1-b6a7-b70a0ed090ee' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

das ist mein code um den displayName zu bekommen:

 async function getMojangProfile(uuid) {
  try {
    const url = `https://api.mojang.com/user/profile/${uuid}`;
    const response = await fetch(url);
    if (!response.ok) throw new Error('Profil nicht gefunden');
    const data = await response.json();
    const displayName = data.name; // Der Name, wie in der API-Antwort enthalten
    return { ...data, displayName };
  } catch (error) {
    console.error(error);
    return null;
  }
}

Vielleicht hat ja jemand das schonmal gemacht, habe schon danach gesucht und auch chatgpt benutzt leider nichts bisher funktioniert

Vielen Dank im vorraus!