cecobask / imdb-trakt-sync

Automatic sync from IMDb to Trakt (watchlist, lists, ratings and history) using GitHub actions.
MIT License
97 stars 229 forks source link

Authentication issues #48

Closed CheraHamza closed 4 months ago

CheraHamza commented 4 months ago

The new method of access broke the whole thing for me. Sync workflows have been failing since. The errors are all related to authentication, caused by the captcha and 2-step authentication page that pops up on each attempt to sign in on a new device, and that prompts you to enter an OTP received by email.

image

I think providing your IMDB username should be enough to access your public IMDB lists, needless of signing up and the issues that come up with it.

cecobask commented 4 months ago

Thanks for reporting, @CheraHamza! I touched on this topic here: https://github.com/cecobask/imdb-trakt-sync/issues/47#issuecomment-2213308585 I can provide a way to pass IMDb cookies to prevent this issue for users who are blocked by captchas. Please bear with me over the next few days đź‘Ť

cecobask commented 4 months ago

@CheraHamza, please check the pull request I mentioned above. More on the way!

CheraHamza commented 4 months ago

@cecobask, I believe that the authentication errors are now bypassed, but the sync workflow is still getting stuck on something.

my latest sync workflow log

cecobask commented 4 months ago

It’s stuck looking for the total number of lists in your account. Do you have any IMDb lists other than a watchlist? It’s possible that when you have none, then the scraping selector div[data-testid='list-page-mc-total-items'] is empty. Please let me know and I can advise further.

CheraHamza commented 4 months ago

I don't have any lists other than the default (watchlist, ratings, check-ins)

cecobask commented 4 months ago

That makes sense, I will add a condition that checks for no lists in the account. It’s hard to spot these edge cases when I’m working off from my own data. Thanks for reporting this!

Donostio commented 4 months ago

I'm stuck with a 'no IMDB email' error but i have added the email, password and lists to the yaml file. Do I need to add it as a secret too, and the password?

cecobask commented 4 months ago

Hi @Donostio, I recommend not committing sensitive data to a public git repository. Anyone can see it and your account can get compromised. The only scenario when you should use the config.yaml file is when you run the app on your own machine (locally). For your use case, please set repository secrets with all relevant values. By looking at the latest sync workflow job in your fork, I can see you haven't provided IMDb email and password.

Donostio commented 4 months ago

Thank you for such a quick reply. I fixed the privacy issue immediately and moved PW and email to secrets. I'm now facing the 'other location' log in issue that I've seen decribed. I get the emails from IMDB with a single use login authentication code to use (but obviously I'm not 'present' in the attempts to us it. I have manually logged in and out of IMDB to try and clear the blockage. The workflow records this:

[debug]/usr/bin/bash -e /home/runner/work/_temp/00c57a4d-971f-4084-a038-74a41eba74cf.sh

{"time":"2024-07-10T07:55:36.095019667Z","level":"INFO","source":{"function":"github.com/cecobask/imdb-trakt-sync/pkg/client.NewIMDbClient","file":"/home/runner/work/imdb-trakt-sync/imdb-trakt-sync/pkg/client/imdb.go","line":69},"msg":"launched new browser instance","url":"ws://127.0.0.1:46405/devtools/browser/0b617ca4-297f-4c8c-88b2-bdf8e6b84558","headless":true,"trace":false} Error: error creating syncer: failure initialising imdb client: failure authenticating user: failure authenticating as captcha prompt appeared make: *** [Makefile:10: sync] Error 1 Error: Process completed with exit code 2

CheraHamza commented 4 months ago

@Donostio apparently you already commited your credentials, anyone can check your commit history and see your credentials. I suggest you delete the fork and make a new one to protect your privacy!

Donostio commented 4 months ago

Oh right, thanks. I deleted the repository and will start again.

Donostio commented 4 months ago

Set it all up again. It looks like I;m still getting stuck on IMDB having a captcha. Is there anything I can tweak to make it work? Thank you

_Run make sync

[debug]/usr/bin/bash -e /home/runner/work/_temp/1d1f281e-e126-4905-a4e6-0788964ae5e9.sh

{"time":"2024-07-10T11:08:36.264635407Z","level":"INFO","source":{"function":"github.com/cecobask/imdb-trakt-sync/pkg/client.NewIMDbClient","file":"/home/runner/work/imdb-trakt-sync/imdb-trakt-sync/pkg/client/imdb.go","line":68},"msg":"launched new browser instance","url":"ws://127.0.0.1:41917/devtools/browser/8c06f0bc-afed-48a7-9a7c-dc80eca5adc7","headless":true,"trace":false} Error: error creating syncer: failure initialising imdb client: failure authenticating user: failure authenticating as captcha prompt appeared make: *** [Makefile:10: sync] Error 1 Error: Process completed with exit code 2.

[debug]Finishing: Sync_

rafae667 commented 4 months ago

You can set IMDB_AUTH to cookies and set up IMDB_COOKIEATMAIN and IMDB_COOKIEUBIDMAIN

Donostio commented 4 months ago

Do I set IMDB_AUTH to cookies in the yaml config file? I've saved the IMDB cookie secrets already.

Thank you

Donostio commented 4 months ago

Run make sync

[debug]/usr/bin/bash -e /home/runner/work/_temp/b60b6e4b-4276-4f9a-ada2-d19fee2841a2.sh

{"time":"2024-07-10T12:11:20.268075141Z","level":"INFO","source":{"function":"github.com/cecobask/imdb-trakt-sync/pkg/client.NewIMDbClient","file":"/home/runner/work/imdb-trakt-sync/imdb-trakt-sync/pkg/client/imdb.go","line":68},"msg":"launched new browser instance","url":"ws://127.0.0.1:42991/devtools/browser/1a5e58d1-f175-4c5d-b661-cfe48815f320","headless":true,"trace":false} Error: error creating syncer: failure initialising imdb client: failure authenticating user: failure doing selector race: context deadline exceeded make: *** [Makefile:10: sync] Error 1 Error: Process completed with exit code 2.

[debug]Finishing: Sync

rafae667 commented 4 months ago

You create secrets for those IMDB_AUTH, IMDB_COOKIEATMAIN and IMDB_COOKIEUBIDMAIN

cecobask commented 4 months ago

Do I set IMDB_AUTH to cookies in the yaml config file? I've saved the IMDB cookie secrets already

@Donostio, don't worry about updating the config.yaml values. The config file is useful for working with the app locally. Any values in the config file can and will be overridden by environment variables (repository secrets). When using the app via GitHub Actions, you only need to update the repository secrets. It all depends on which IMDb auth method you're using. Based on that, the app will take into account particular secrets and ignore irrelevant ones. Even if you create repository secrets for both a credential pair (IMDB_EMAIL, IMDB_PASSWORD) and a cookie pair (IMDB_COOKIEATMAIN, IMDB_COOKIEUBIDMAIN), it won't be a problem as you will be able to switch between them with the IMDB_AUTH secret.