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
75 stars 5 forks source link

Cannot send verification code #37

Open Maxence-r opened 6 months ago

Maxence-r commented 6 months ago

The following routes are no longer working:

/login/send-code/vonage /login/send-code

Response:

{
  "status": 400,
  "message": "OTP not sent"
}
alpha-157 commented 5 months ago

Even when logging in successfull by using login/refresh (which still works fine) friends/feed endpoint no longer works: { "status": 500, "message": "Internal server error", "data": { "message": "Request failed with status code 401", "name": "AxiosError", "stack": "AxiosError: Request failed with status code 401\n at settle (/app/node_modules/axios/dist/node/axios.cjs:1966:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3065:11)\n at IncomingMessage.emit (node:events:531: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:3876:41)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async BeFake._apiRequest (/app/dist/BeFake/BeFake.js:349:26)\n at async BeFake.getFriendsFeed (/app/dist/BeFake/BeFake.js:365:26)\n at async FriendsService.getFeed (/app/dist/friends/friends.service.js:31:26)\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" ], "transformRequest": [ null ], "transformResponse": [ null ], "timeout": 0, "xsrfCookieName": "XSRF-TOKEN", "xsrfHeaderName": "X-XSRF-TOKEN", "maxContentLength": -1, "maxBodyLength": -1, "env": {}, "headers": { "Accept": "application/json, text/plain, /", "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJVSUxMd1BqcFhFU3lsZlFESGVSY01hVFdKZ1cyIiwidXNlcl9pZCI6IlVJTEx3UGpwWEVTeWxmUURIZVJjTWFUV0pnVzIiLCJwaG9uZV9udW1iZXJfY291bnRyeV9jb2RlIjoiREUiLCJpc3MiOiJodHRwczovL2F1dGguYmVyZWFsLnRlYW0vIiwiYXVkIjoiaW9zIiwiaW1wZXJzb25hdGVkX2J5IjpudWxsLCJpYXQiOjE3MTI4NjU2OTYsImV4cCI6MTcxMjg2OTI5Nn0.bI_IRlS7hUJKpCeCjYn3JKOSlKPCWXfeeV4AtOz9B2E", "bereal-app-version-code": "14549", "bereal-signature": "MToxNzEwOTU0MTc2OmPlM3WPWqPWRq7EseRiT98fErcmwWg1yUatGmYZnzaH", "bereal-timezone": "Europe/Paris", "bereal-device-id": "937v3jb942b0h6u9", "User-Agent": "axios/1.6.8", "Accept-Encoding": "gzip, compress, deflate, br" }, "method": "get", "url": "https://mobile.bereal.com/api/feeds/friends-v1" }, "code": "ERR_BAD_REQUEST", "status": 401 } }

chemokita13 commented 5 months ago

Even when logging in successfull by using login/refresh (which still works fine) friends/feed endpoint no longer works: { "status": 500, "message": "Internal server error", "data": { "message": "Request failed with status code 401", "name": "AxiosError", "stack": "AxiosError: Request failed with status code 401\n at settle (/app/node_modules/axios/dist/node/axios.cjs:1966:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3065:11)\n at IncomingMessage.emit (node:events:531: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:3876:41)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async BeFake._apiRequest (/app/dist/BeFake/BeFake.js:349:26)\n at async BeFake.getFriendsFeed (/app/dist/BeFake/BeFake.js:365:26)\n at async FriendsService.getFeed (/app/dist/friends/friends.service.js:31:26)\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" ], "transformRequest": [ null ], "transformResponse": [ null ], "timeout": 0, "xsrfCookieName": "XSRF-TOKEN", "xsrfHeaderName": "X-XSRF-TOKEN", "maxContentLength": -1, "maxBodyLength": -1, "env": {}, "headers": { "Accept": "application/json, text/plain, /", "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJVSUxMd1BqcFhFU3lsZlFESGVSY01hVFdKZ1cyIiwidXNlcl9pZCI6IlVJTEx3UGpwWEVTeWxmUURIZVJjTWFUV0pnVzIiLCJwaG9uZV9udW1iZXJfY291bnRyeV9jb2RlIjoiREUiLCJpc3MiOiJodHRwczovL2F1dGguYmVyZWFsLnRlYW0vIiwiYXVkIjoiaW9zIiwiaW1wZXJzb25hdGVkX2J5IjpudWxsLCJpYXQiOjE3MTI4NjU2OTYsImV4cCI6MTcxMjg2OTI5Nn0.bI_IRlS7hUJKpCeCjYn3JKOSlKPCWXfeeV4AtOz9B2E", "bereal-app-version-code": "14549", "bereal-signature": "MToxNzEwOTU0MTc2OmPlM3WPWqPWRq7EseRiT98fErcmwWg1yUatGmYZnzaH", "bereal-timezone": "Europe/Paris", "bereal-device-id": "937v3jb942b0h6u9", "User-Agent": "axios/1.6.8", "Accept-Encoding": "gzip, compress, deflate, br" }, "method": "get", "url": "https://mobile.bereal.com/api/feeds/friends-v1" }, "code": "ERR_BAD_REQUEST", "status": 401 } }

Hey! It seems they have changed the requests signature, let me see it

Maxence-r commented 5 months ago

After further investigation, we resolved the issue by replacing the Google API key, as the problem was not linked to the signature. However, I recommend updating the Google API key to a new, valid one and configuring automatic signature updates using the happy-headers library, which can be found at https://www.npmjs.com/package/happy-headers. This library is also employed by another project that has successfully automated signature predictions up to 2026, eliminating the need for frequent manual updates. For more details on how it's implemented, you can refer to https://github.com/s-alad/toofake, where they are utilizing this solution.

Thanks again !

chemokita13 commented 5 months ago

After further investigation, we resolved the issue by replacing the Google API key, as the problem was not linked to the signature. However, I recommend updating the Google API key to a new, valid one and configuring automatic signature updates using the happy-headers library, which can be found at https://www.npmjs.com/package/happy-headers. This library is also employed by another project that has successfully automated signature predictions up to 2026, eliminating the need for frequent manual updates. For more details on how it's implemented, you can refer to https://github.com/s-alad/toofake, where they are utilizing this solution.

Thanks again !

Hey I have updated the key manually, but let me check that, thank you so much! And then I will be with otp issue, any toughts about this?

Maxence-r commented 5 months ago

The update to the Google API key resolved the issue with OTP verification via Google, but it did not address the problem with the vantage endpoint; I have no further information on this matter. I have not tested other endpoints yet, but they should function as expected. If any do not, please let me know which ones are problematic.

chemokita13 commented 5 months ago

`Hey! @Maxence-r The happy-headres package is giving me a problem and I do not know how to solve it. I am using nestjs and when I import the package like a module:import getHeaders from 'happy-headers';when I start debugging withpnpm run start:dev` is giving me error because when nestjs build javascript from typescript is using require() function and this is throwing a error:

// ./dist/BeFake/BeFake.js
//...
const happy_headers_1 = require("happy-headers");
// ...

The branch where I am working is happy-headers If you can help me.

chemokita13 commented 5 months ago

Also I have done a pull request changing come headers from the otp vonage functions, you can try it now!