-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: saves twitter cookies to envs #598
Conversation
await scraper.login(username, password, email); | ||
return { success: true }; | ||
const cookies = await scraper.getCookies(); | ||
return { success: true, cookies }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the call to scraper.login always use the password? I think we first should check whether we already have the cookies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably we can check if the cookies already exists in that path (TWIKIT_COOKIES_PATH
), but I guess (correct me if I'm wrong) this logic is only executed once, at the time of registering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what it should happen, but not what it is happening. On validation failure it tries again. Or what if the user closes the app before starting the agent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is FE code only @dvilelaf. this is for the form where a user first time enters their credentials, we only once validate them (by using scraper.login) and write the cookies recieved. we don't allow to change that, so it won't be called ever again from FE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that. So if a user:
- Opens Pearl for the first time
- Fills in the form and data is validated
- User closes the app
- User re-opens the app
The login wont be called again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say this because this morning I saw 2 succesfull logins being made from the validation form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not from FE side. but I assume from BE it will - when starting an agent. and here @OjusWiZard might need to update that (or correct me)
await scraper.login(username, password, email); | ||
return { success: true }; | ||
const cookies = await scraper.getCookies(); | ||
return { success: true, cookies }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the call to scraper.login always use the password? I think we first should check whether we already have the cookies.
@@ -151,6 +153,10 @@ const SetupYourAgentForm = ({ serviceTemplate }: SetupYourAgentFormProps) => { | |||
...serviceTemplate.env_variables.TWIKIT_PASSWORD, | |||
value: values.xPassword, | |||
}, | |||
TWIKIT_COOKIES: { | |||
...serviceTemplate.env_variables.TWIKIT_COOKIES, | |||
value: cookies, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will write it in the format of:
'{"guest_id_marketing":"111","guest_id_ads":"111","personalization_id":"111","guest_id":"111","kdt":"111","twid":"111","ct0":"111","auth_token":"111","att":"111"}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's only a key named _twitter_sess
missing when I compare it to the cookies that are generated by the BE validation. @dvilelaf do you know if that will cause any issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is needed, but I'm not 100% sure. I definitely have it in my cookies
Signed-off-by: OjusWiZard <[email protected]>
Proposed changes
save twitter cookies stringified json to env variables so it can be then processed by BE
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that apply