Open MaximumPotato opened 3 years ago
I've tried opening up chromium in the puppeteer directory and logging in thru there, which works fine. It doesn't carry over when running the script however. Guessing it's a cookies issue when running the script, but I'm not familiar with the inner workings of puppeteer.
If anyone stumbles upon this in the future with a similar problem give me a ping, I've pretty much given up at this point.
@Revadike Any ideas?
I've tried opening up chromium in the puppeteer directory and logging in thru there, which works fine. It doesn't carry over when running the script however. Guessing it's a cookies issue when running the script, but I'm not familiar with the inner workings of puppeteer.
In puppeteer you can define where to store the browser session data - as you can see below i stored it in /tmp/testSessions.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false, userDataDir: '/tmp/testSessions'});
const page = await browser.newPage();
await page.goto('https://google.com');
})();
Then if you modify the index.js of epicgames-client-login-adapter in the init function and add the userDataDir parameter for puppeteer, then it will extract the data from previous browser sessions.
E.g: in the init function
const browser = await Puppeteer.launch({
headless: false,
userDataDir: '/tmp/testSessions',
defaultViewport: {
width: options.width,
height: options.height,
},
args: [
`--window-size=${options.width},${options.height}`,
`--lang=${options.language}`,
],
...options.puppeteer,
});
Then I had to remove this (below) because it caused the script to error out and there was no need for it as I was already logged in.
const login = credentials.login || credentials.email || credentials.username;
if (login && credentials.password) {
const loginWithEpicButton = await page.waitForSelector('#login-with-epic');
await loginWithEpicButton.click();
const usernameOrEmailField = await page.waitForSelector('#email');
await usernameOrEmailField.type(login, { delay: options.inputDelay });
const passwordField = await page.waitForSelector('#password');
await passwordField.type(credentials.password, { delay: options.inputDelay });
const loginButton = await page.waitForSelector('#login:not(:disabled)');
await loginButton.click();
}
Then Success 👍
@josephnglynn That did work despite giving me an error you didn't get.
I have attempted to create this directory manually in several different locations however the error still appears.
Oddly enough if I remove the userDataDir
variable as well as the login code everything works fine.
@josephnglynn That did work despite giving me an error you didn't get.
I have attempted to create this directory manually in several different locations however the error still appears.
Oddly enough if I remove the
userDataDir
variable as well as the login code everything works fine.
Sorry, I didn't read your logs above showing that you are on windows - for some crazy reason I assumed you were on linux.
On windows I don't think you can create a /tmp directory because of the way the file system works, so instead you would change it to something like:
userDataDir: 'C:/testSessions'
I had the same issue and the steps mentionned above didn't seem to solve the issue. But when I tried to login through epic game I saw I had the same error. It must be because I failed to login to many times. So I retried through the Epic Games launcher and it worked. Then it worked with the script. Adding a userDataDir added an issue where if I logged in once it would send me to the preferences page of my EG profile. I just commented the line and now it works perfectly.
I had the same issue, this doesn't belong here though. Moving this issue.
@Revadike Good timing on the issue move, the other repo got nuked.
I was just looking for a ticket I had opened and solved over there so I don't have to work thru this other problem again. :~)
Run npm start, the script asks me to attempt to solve the captcha manually, and then I see this:
Here's the corresponding run in the console: