0

I'm sending a request to discord's /guilds/{guild.id}/members/{user.id} endpoint,

fetch(`https://discord.com/api/guilds/*REDACTED*/members/*REDACTED*`, {
    method: 'patch', 
    headers: {
        "Authorization": `Bot ${oAuth.token}`
    },
    body: {
        'nick': 'test'
    }
}).then((response)=> response.json()).then((result) => {
    console.log(result)
})

But it keeps logging this error in the console:

Access to fetch at 'https://discord.com/api/guilds/REDACTED/members/REDACTED' from origin '************' 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.

I don't seem to understand why it's not working :/

This is done with pure js.

0 Answers0