Login Session avatar
Login Session
Try for free

No credit card required

View all Actors
Login Session

Login Session

pocesar/login-session
Try for free

No credit card required

Get localStorage, sessionStorage and cookies from logins for usage in other actors.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn mode

Node.js

Python

curl

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "userAgent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36",
11    "maxRequestRetries": 0,
12    "sessionConfig": {
13        "storageName": "login-sessions",
14        "maxAgeSecs": 3600,
15        "maxUsageCount": 100,
16        "maxPoolSize": 100
17    },
18    "steps": [
19        {
20            "username": {
21                "selector": "input#email"
22            },
23            "password": {
24                "selector": "input#pass"
25            },
26            "submit": {
27                "selector": "input[type=\"submit\"]"
28            },
29            "failed": {
30                "selector": "[role=\"alert\"]"
31            },
32            "waitForMillis": 5000
33        }
34    ],
35    "cookieDomains": [],
36    "gotoTimeout": 30,
37    "proxyConfiguration": {
38        "useApifyProxy": true
39    },
40    "extraUrlPatterns": []
41};
42
43(async () => {
44    // Run the Actor and wait for it to finish
45    const run = await client.actor("pocesar/login-session").call(input);
46
47    // Fetch and print Actor results from the run's dataset (if any)
48    console.log('Results from dataset');
49    const { items } = await client.dataset(run.defaultDatasetId).listItems();
50    items.forEach((item) => {
51        console.dir(item);
52    });
53})();
Developer
Community logoMaintained by Community
Actor metrics
  • 9 monthly users
  • 8.7% runs succeeded
  • Created in Feb 2020
  • Modified almost 3 years ago
Categories

You might also like these Actors