Overview
This appstate login getter is a simple Node.js application that uses Puppeteer to log into Facebook. The application takes an email and password as query parameters and returns a JSON response with cookies and other session data. The app uses Puppeteer for browser automation and logging into Facebook securely.
API Endpoints
GET /appstate
Logs into Facebook with the provided email and password and returns session data (cookies and datr cookie). The response is in JSON format.
Request Parameters
- e: Email address for Facebook login
- p: Password for Facebook login
Example Request (Node.js)
const axios = require('axios');
// Dynamically fetch the current host
const currentHost = window.location.host;
const apiUrl = `http://${currentHost}/appstate`; // Create the full API URL
axios.get(apiUrl, {
params: {
e: 'your-email@example.com',
p: 'yourpassword'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
Example Response
{
"cookies": "cookie1=value1; cookie2=value2",
"jsonCookies": [
{
"domain": ".facebook.com",
"expirationDate": 1673811600,
"hostOnly": false,
"httpOnly": true,
"name": "cookie1",
"path": "/",
"sameSite": "Strict",
"secure": true,
"session": false,
"storeId": "12345",
"value": "value1"
},
{
"domain": ".facebook.com",
"expirationDate": 1673811600,
"hostOnly": false,
"httpOnly": true,
"name": "cookie2",
"path": "/",
"sameSite": "Strict",
"secure": true,
"session": false,
"storeId": "12345",
"value": "value2"
}
],
"datr": "abcdef123456",
"status": "success"
}
Example Request (Python)
import requests
# Dynamically fetch the current host
current_host = window.location.host
api_url = f"http://{current_host}/appstate"
response = requests.get(api_url, params={'e': 'your-email@example.com', 'p': 'yourpassword'})
print(response.json())
Example Request (PHP)
<?php
$host = $_SERVER['HTTP_HOST'];
$apiUrl = "http://{$host}/appstate";
$response = file_get_contents("{$apiUrl}?e=your-email@example.com&p=yourpassword");
echo $response;
?>
Example Request (cURL)
curl -X GET "http://{currentHost}/appstate?e=your-email@example.com&p=yourpassword"