Facebook-chat-api: HTML Received instead of JSON in pull request.

Created on 4 Mar 2020  路  23Comments  路  Source: Schmavery/facebook-chat-api

Trying to login:

ERR! login Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.
{ error: 'Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.' }

Login code:

const obj = {email: "**[REDACTED]**", password: "**[REDACTED]**"};

login(obj, (err, api) => {

    if(err) {

        switch (err.error) {

            case 'login-approval':

                console.log('Enter code > ');

                rl.on('line', (line) => {
                    err.continue(line);
                    rl.close();
                });

                break;

            default:

                console.error(err);

        }

        return;

    }

Most helpful comment

I'll make a PR in a moment to fix this issue.

All 23 comments

I have the same problem, and pretty similar login code.
Also this issue and #793 are identical.

I was able to resolve this by generating a new app state.

This code is used to generate apostate.

I was able to resolve this by generating a new app state.

is works (Edit : Now using this solution does not work)

What if this is the code that generates my appstate, and it does not work

Facebook removed pull.

yes, i'm working on it

I'm also getting this error now, regardless of whether I'm logging in from an appstate or a fresh login.

I can't login today.
and generating new appstate is not work.

info login Logging in...
info login You have login approvals turned on.
ERR! login login-approval
Enter code >
******
info login Logged in
info login Request to reconnect
info login Request to pull 1
ERR! login Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.
{
  error: 'Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.'
}

I think facebook pushed this change to everyone now.

I'm now seeing the same error as @PusanStudio as unable to generate a new app state 馃槶

Any updates on this?

@lequanglam Any updates?

@lequanglam Any updates?

you can use my forked repo (fca-unofficial) to bypass that pull request. i'm still working on it through.

@lequanglam Cool, seems to be working great so far. I'm using this in BotCore now if anyone is looking for a way to abstract away their login issues (and I'll switch this back to mainline once the fix gets merged).

@lequanglam @AstroCB Any way to login in as detailed as possible?
Best regards to everyone.

@JosephBBa You can take a look at the docs here.

The easiest way to get running is this:

const botcore = require("messenger-botcore");
botcore.login.login({
    EMAIL: "[email protected]",
    PASSWORD: "your_password"
}, (err, api) => {
    // Your code here
});

You can then use the API as usual. You might also need some credentials from Memcachier as explained in the docs. If you run into any issues, feel free to post on the repo 鈥撀營 don't want to clutter this thread.

(fca-unofficial) Why Connection closed.
Shortly after running the bot.

info login Logged in
info login Request to base pull
WARN login Error inside first pull request. Received HTML instead of JSON. Facebook might removed pull request for this account.
WARN login Bad response from base pull (t: pull-removed)
info login Done logging in.

{
  type: 'message',
  senderID: '******',
  body: '馃帀',
  threadID: '******',
  messageID: '******',
  attachments: [],
  mentions: {},
  timestamp: '******',
  isGroup: true
}
Connection closed.

(fca-unofficial) Why Connection closed.
Shortly after running the bot.

info login Logged in
info login Request to base pull
WARN login Error inside first pull request. Received HTML instead of JSON. Facebook might removed pull request for this account.
WARN login Bad response from base pull (t: pull-removed)
info login Done logging in.

{
  type: 'message',
  senderID: '******',
  body: '馃帀',
  threadID: '******',
  messageID: '******',
  attachments: [],
  mentions: {},
  timestamp: '******',
  isGroup: true
}
Connection closed.

ignore it, MQTT.js will automatically make a new connection.

When the connection is closed
MyBot no listen event come in.

Any updates? I'm still having this problem atm

`
info login Logging in...
info login You have login approvals turned on.
ERR! login login-approval
Enter code >

info login Logged in
info login Request to reconnect
info login Request to pull 1
ERR! login Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.
{
error: 'Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.'
}
`

I'll make a PR in a moment to fix this issue.

I still facing the same issue

const login = require("facebook-chat-api");
const credential = {
    email: "email",
    password: "password"
};

login(credential, (err, api) => {
    console.log(err);
});

returns

info login Request to pull 1

ERR! login Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.

{ error:
   'Error inside first pull request. Received HTML instead of JSON. Logging in inside a browser might help fix this.' }

Please use the latest bleeding edge version from github.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ezaca picture ezaca  路  3Comments

KuoyuanY picture KuoyuanY  路  7Comments

Alcap picture Alcap  路  7Comments

DanH42 picture DanH42  路  3Comments

standnguyen197 picture standnguyen197  路  4Comments