Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

283
Visualizações
Can't find any way to get POST requests working Reddit API - 403 Error

I'm trying to build a reddit-like app on react native, so i'm using axios to fetch requests to Reddit Api and I can't seem to be able to fetch any POST requests, I've tried everything I can, I'm trying to subscribe to a subreddit, here is my request :

subscribe: async function subscribe(action, sub, modhash) {
       try {
    const token = await this.getAccessToken();
    console.log('token: ' + token)
    let Headers = {'Authorization': 'Bearer ' + token,
      'Content-Type': 'application/json',
      'X-Modhash': modhash}
    let Params =  {'action': action, 'sr_name': sub}
    let Body = {'api_type': "json", "extension": "json"}
    await axios.post('https://oauth.reddit.com/api/subscribe', Headers, Params, Body)
    .then((response) => {
      console.log('sub: ' + JSON.stringify(response.data));
      console.log("Subbed to " + sub)
    })
  } catch (error) {
    throw 'Could not sub: ' + error
  }
},

Here is the Catch result:

"Could not sub: Error: Request failed with status code 403"

here is the official api about subscribe : https://www.reddit.com/dev/api/#POST_api_subscribe

action = "sub" and sr = "t5_2qh03" and I tried sr_name and sr but none seems to work, I'm sure the token is valid since it works with other GET requets I can't find what I did wrong here. Do you guys have any idea on what I'm missing ?

Edit: I've tried the same request with postman and the request actually worked, i did sub to a subreddit, but the same exact request is not working with axios, does my request is okay ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To me, your code is alright.

However, the Reddit API is such a clusterfuck, that peoples are not much using it.

They are using pupeeter and similar.

For your problem, it all depends of the subreddit, some (many) are not allowing to POST by API at all, of course without warning, or with totally unclear HTTP error codes It just doesn't work.

There is also situations where it works, but only sometimes, or only the first time, or only from an IP of a given allowed country.

They are also widely using black/grey/white listing, shadow banning, and rate limiting. But no notices are ever given. The definition of a clusterfuck.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda