GithubHelp home page GithubHelp logo

chemokita13 / bereal-api Goto Github PK

View Code? Open in Web Editor NEW
70.0 1.0 5.0 440 KB

A not official BeReal rest API in wich you can get all posts info, comment, upload a post...

Home Page: https://berealapi.fly.dev

JavaScript 0.44% TypeScript 99.43% Dockerfile 0.13%
befake bereal

bereal-api's Introduction

Hi! I'm Jose Maria, a full-stack hobbie developer ๐Ÿ‘จโ€๐Ÿ’ป
learning since 2019 ๐Ÿš€ ๐Ÿ‡ช๐Ÿ‡ธ

  • ๐Ÿ“ƒ I'm actually performing my BeReal API ๐Ÿ“‹
  • โš›๏ธ Iโ€™m currently learning kubernetes and docker ๐Ÿ‹

Contact me

[email protected]


Stats

TryHackMe


Donate

PayPal

You can buy me a cofee by PayPal:

ETH

You can make me a ETH transfer if you want:

  3bb34ae4f91774003a8f6a42b5f39bdd8d09f1f467f7e556f2c1bdea5d8c0dc6

bereal-api's People

Contributors

aaditt avatar chemokita13 avatar y4aniv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bereal-api's Issues

Get memories

It would be nice to be able to fetch memories

Cannot send verification code

The following routes are no longer working:

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

Response:

{
  "status": 400,
  "message": "OTP not sent"
}

Unable to send code with UK phone number

When using a UK phone number (+44) the request return with status 400. When using the alternative endpoint (/login/send-code/vonage) an error is outputed to the terminal.

image
image

I have gotten it to work with a USA number but cannot seem to do the same for a UK one

codeError.txt

Problem with the login

I created an app that allows other people to download bereals.
Using the same backend to login, UK users with prefix +44 are unable to do so. I get the following error:
{'error': {'code': 400, 'message': 'APP_NOT_VERIFIED', 'errors': [{'message': 'APP_NOT_VERIFIED', 'domain': 'global', 'reason': 'invalid'}]}}

Does anyone have a solution or has faced this problem already?

Caption are no longer supported

When I make the api call to post/upload/data endpoint I get a 400 error.
And when I try making the api call directly to the BeReal API, I get the same error with the following body:

{
    "error": "Bad Request",
    "statusCode": 400,
    "message": "Bad Request",
    "errorKey": "bad-request",
    "data": null,
    "fields": [
        "caption"
    ],
    "timestamp": "2023-11-01T12:04:10.248Z",
    "requestId": "62...af0"
}

I tried again without the caption property (directly with the BeReal API) and it works.
So the captions have probably been moved to another endpoint.

Friends list

When I make the api call to the "relationships/friends" endpoint I get a response that it has the correct number of friends but I only get 50 users and not the actual number. Below is an example response:

{'next': '0eHV2jH................lGHP2', 'total': 53, 'data': []}
In data i recieve 50 keys and not 53

Internal server error on /post and /friends again

I guess BeReal has just changed some endpoints again as none of the "Friends" and "Post" GET functions work for me anymore. Starting today I keep getting 500 internal server error with my valid token.
However login functions and ping server still work (just like last month when it broke).

Executing any GET functions returns:
{
"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:1967:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3066: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:3877: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:364: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... (token replaced)",
"bereal-app-version-code": "14549",
"bereal-signature": "berealsignature",
"bereal-device-id": "berealdeviceid",
"User-Agent": "axios/1.6.7",
"Accept-Encoding": "gzip, compress, deflate, br"
},
"method": "get",
"url": "https://mobile.bereal.com/api/feeds/friends-v1"
},
"code": "ERR_BAD_REQUEST",
"status": 401
}

Issue with post/upload/data

Getting the error shown below while trying to execute the post/upload/data (step 3) request. Do you know why I am getting this error? Step 1 and 2 work as expected. Have i put some wrong information in "postData"?

My request body:
{
"postData": {
"resize": false,
"late": true,
"visibility": "friends",
"retakes": 0,
"caption": "Hello",
"taken_at": "2024-01-14T16:14:51.123Z",
"location": "[48.864716, 2.349014]"
},
"tokenData": "here is my postDataToken"
}

This is what the server responses:
{
"status": 500,
"message": "Internal server error",
"data": {
"response": {
"status": 400,
"message": "Post not created",
"data": {
"done": false,
"msg": {
"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:1970:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3069: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)",
"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, /",
"Content-Type": "application/json",
"Authorization": "Bearer censored",
"user-agent": "BeReal/1.0.1 (AlexisBarreyat.BeReal; build:9513; iOS 16.0.2) 1.0.0/BRApriKit",
"x-ios-bundle-identifier": "AlexisBarreyat.BeReal",
"Content-Length": "442",
"Accept-Encoding": "gzip, compress, deflate, br"
},
"method": "post",
"url": "https://mobile.bereal.com/api/content/posts",
"data": "{"isLate":true,"retakeCounter":0,"takenAt":"2024-01-14T16:14:51.123[Z]","caption":"Hello","visibility":["friends"],"backCamera":{"bucket":"storage.bere.al","height":2000,"width":1500,"path":"Photos/censored/post/censored.webp"},"frontCamera":{"bucket":"storage.bere.al","height":2000,"width":1500,"path":"Photos/censored/post/censored.webp"},"location":{"latitude":"[","longitude":"4"}}"
},
"code": "ERR_BAD_REQUEST",
"status": 400
}
}
},
"status": 400,
"message": "Post not created",
"name": "HttpException"
}
}
I replaced private stuff with "censored".

Error 500 on /login/refresh

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"
  }
}

Update Error Code on JSON root

When I request any endpoint (in this example /login/verify) and endpoint returns error code, please provide it on root, instead of 500.

Example:

{
    "status": 500,
    "message": "Internal server error",
    "data": {
        "response": {
            "status": 400,
            "message": "OTP not verified",
            "data": {
                "error": {
                    "code": 400,
                    "message": "SESSION_EXPIRED",
                    "errors": [
                        {
                            "message": "SESSION_EXPIRED",
                            "domain": "global",
                            "reason": "invalid"
                        }
                    ]
                }
            }
        },
        "status": 400,
        "message": "OTP not verified",
        "name": "HttpException"
    }
}

Please put 400 instead of 500 :)

Update API Documenation

Hi, there are some typos and not correct definitions in request/response bodies.
Please update the documentation.

internal server error on /post and /friends

I guess BeReal just changed some endpoints as none of the "Friends" and "Post" GET functions work for me anymore. Yesterday everything still worked fine but starting today I keep getting 500 internal server error with my valid token.
However login functions an ping server still work.

Only one memory per day available

Hi,
I realised that only one bereal per day (the first one) is available in the memory feed (/friends/mem-feed). This is unfortunate since for a while there has been the option to upload multiple bereals per day. From my understanding of the code (

async getMemFeed(): Promise<BeFakeResponse> {
) you are forwarding the raw response from bereal, right? Do you have an idea how to get the remaining bereals?

Btw thanks a lot for this amazing repo!

/login/send-code returns 201 although BeReal returns 400

Apparently I tried to login too many times. So BeReal returns 400 as error, but your API returns 201.
This is the JSON returned by your API:
{"status":201,"message":"OTP sent","data":{"otpSession":{"error":{"code":400,"message":"TOO_MANY_ATTEMPTS_TRY_LATER","errors":[{"message":"TOO_MANY_ATTEMPTS_TRY_LATER","domain":"global","reason":"invalid"}]}}}}

404 Error

I have an issue even accessing the localhost. I have successfully deployed as you can see in the image below. However when trying to access localhost:3000 I get a 404 Not Found error ({"statusCode":404,"message":"Cannot GET /","error":"Not Found"}).
This happens both on my laptop and desktop. Have I missed something?

Screenshot 2024-01-12 214925

/login/verify not working as expected

So I am trying to use the API. Still, when I try to use the verify endpoint I get an internal server error, then a bit further into the response this message "Requests from this iOS client application are blocked." so yeah is it a problem on my side, or server-side if yes is there a way I could fix that.

thanks for the help already :)

{
    "status": 500,
    "message": "Internal server error",
    "data": {
        "response": {
            "status": 400,
            "message": "OTP not verified",
            "data": {
                "error": {
                    "code": 403,
                    "message": "Requests from this iOS client application <empty> are blocked.",
                    "errors": [
                        {
                            "message": "Requests from this iOS client application <empty> are blocked.",
                            "domain": "global",
                            "reason": "forbidden"
                        }
                    ],
                    "status": "PERMISSION_DENIED",
                    "details": [
                        {
                            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
                            "reason": "API_KEY_IOS_APP_BLOCKED",
                            "domain": "googleapis.com",
                            "metadata": {
                                "consumer": "projects/405768487586",
                                "service": "identitytoolkit.googleapis.com"
                            }
                        }
                    ]
                }
            }
        },
        "status": 400,
        "message": "OTP not verified",
        "name": "HttpException"
    }
}

can I get own post history?

In the app one can see own history, but I don't see such an endpoint in swagger. Is it supported? Thanks!

random 400 error code on `login/send-code/`

i am getting random 400 error code on the login/send-code/ endpoint. sometimes it works with success, sometimes i get this 400 error code.

can you please provide some clarity as to why i am getting this error, or possibly fix? thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.