chemokita13 / beReal-api

A not official BeReal rest API in wich you can get all posts info, comment, upload a post...
https://berealapi.fly.dev
73 stars 5 forks source link

Error 500 on /login/refresh #43

Closed mth-bou closed 2 months ago

mth-bou commented 2 months ago

I've been using your API for a few weeks now and it's been working perfectly until today. I have my old valid token previously received via the API /login/verify route and which has expired. So I'm trying to refresh it by passing it to the /login/refresh route, but I'm still getting a 500 error. I hope the BeReal API hasn't been changed recently. Here's the response error :

{
  "status": 500,
  "message": "Internal server error",
  "data": {
    "response": {
      "status": 400,
      "message": "Token not refreshed",
      "data": {
        "message": "Request failed with status code 400",
        "name": "AxiosError",
        "stack": "AxiosError: Request failed with status code 400\n    at settle (/app/node_modules/axios/dist/node/axios.cjs:1983:12)\n    at IncomingMessage.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3085:11)\n    at IncomingMessage.emit (node:events:532:35)\n    at endReadableNT (node:internal/streams/readable:1696:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n    at Axios.request (/app/node_modules/axios/dist/node/axios.cjs:4224:41)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async BeFake.refreshTokens (/app/dist/BeFake/BeFake.js:166:30)\n    at async LoginService.refreshToken (/app/dist/login/login.service.js:177:43)\n    at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28\n    at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17",
        "config": {
          "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
          },
          "adapter": [
            "xhr",
            "http",
            "fetch"
          ],
          "transformRequest": [
            null
          ],
          "transformResponse": [
            null
          ],
          "timeout": 0,
          "xsrfCookieName": "XSRF-TOKEN",
          "xsrfHeaderName": "X-XSRF-TOKEN",
          "maxContentLength": -1,
          "maxBodyLength": -1,
          "env": {},
          "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/json",
            "User-Agent": "axios/1.7.2",
            "Content-Length": "143",
            "Accept-Encoding": "gzip, compress, deflate, br"
          },
          "params": {
            "grant_type": "refresh_token"
          },
          "method": "post",
          "url": "https://auth.bereal.team/token",
          "data": "{\"grant_type\":\"refresh_token\",\"client_id\":\"ios\",\"client_secret\":\"962D357B-B134-4AB6-8F53-BEA2B7255420\",\"refresh_token\":\"OppmErrB_x45-_NsFWzOE\"}"
        },
        "code": "ERR_BAD_REQUEST",
        "status": 400
      }
    },
    "status": 400,
    "message": "Token not refreshed",
    "name": "HttpException"
  }
}
chemokita13 commented 2 months ago

Yeah, there is a issue when refreshing token, it seems like a header remaining or something, it will be corrected as fast I can!

mth-bou commented 2 months ago

Thanks for your quick reply! I'll also look for a solution on my side :)

chemokita13 commented 2 months ago

Solved! @mth-bou

mth-bou commented 2 months ago

Solved! @mth-bou

Thanks for your quick fix ! Everything is back to normal