Unable to get token oauth 405 http error

Hi there,
I created an Sentry application under Settings > Account > API > Applications.
My web server receives the callback requests with the code param.
But whenever I send a token request like below I receive HTTP 405 error.

    fetch("https://sentry.io/oauth/token", {
      method: "post",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        client_id: sentry_client_id,
        client_secret: sentry_secret,
        grant_type: "authorization_code",
        redirect_uri: "http://localhost:8000/app/dashboard.html",
        code: code,
      }),
    })

Thanks in advance

Hi,

I’m quite sure this is because you are passing http://localhost:8000 as your redirect_url which is unsafe. Also, Sentry servers won’t be able to communicate with your local server with that address.

I recommend using a service like ngrok to get a public URL that tunnels back to your local and trying with that public address.