reddsaver: missing feild 'access token'

I’ve installed using cargo and when I run the script I get:

λ ~/Downloads/Programs/reddsaver reddsaver -e reddsaver.env -d ~/Pictures/reddit/
Error: ReqwestError(reqwest::Error { kind: Decode, source: Error("missing field `access_token`", line: 1, column: 26) })

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 38 (22 by maintainers)

Most upvoted comments

Thanks @Ramiferous - It’s probably a good idea to remove the debug binary and reinstall with cargo. I’ll be making a new release this weekend with the all the necessary debug information embedded in case anyone else encounters a similar issue.

@itkovian - I’m closing this issue. It looks your issue might be different from the others in the thread. Please free to open a new issue (with your system details).

The error is caused by having 2FA enabled within Reddit. I got the same error about missing an access_token field. Disabling 2FA in Reddit settings fixed the issue.

Try using env -i to run in a clean environment

That did the trick. Thanks.

Would it be a good idea not to remove the debug binary and install the normal way, or with cargo?

Also, feel free to close this issue as it is solved for me. I’ll leave that up to you 👍

Great @CitronSorcier ! - Glad you got it to work finally.

There was a conflict in my PATH (solved), and like @Ramiferous, the USERNAME used was my computer’s, not from my reddit account (also solved, after unsetting it).

Finally, after enabling and disabling 2FA, it worked! 😃

Thanks for the logs @Ramiferous - the OS environment variables seems to be overriding the USERNAME variable from reddsaver.env file. The solution would be to unset the environment variable before running the app –

unset USERNAME
reddsaver -d <...> -e <..>

Seems like the PASSWORD field in the .env file needs to be set as PASSWORD=<password>:<2FA_token> accrding to documentation from PRAW: https://praw.readthedocs.io/en/latest/getting_started/authentication.html#two-factor-authentication.

@kdkasad Thanks a lot for the help. Would you be able to give it a go using the above method?

It works by appending a colon and the TOTP code to the password. Thanks for the fast response!

Thanks a lot @kdkasad ! - that makes a lot of sense. I don’t have an email attached to my Reddit account, so I never knew there was an option for 2FA.

Seems like the PASSWORD field in the .env file needs to be set as PASSWORD=<password>:<2FA_token> accrding to documentation from PRAW: https://praw.readthedocs.io/en/latest/getting_started/authentication.html#two-factor-authentication.

@kdkasad Thanks a lot for the help. Would you be able to give it a go using the above method?