andrewbanchich / shreddit

Delete your Reddit data.
MIT License
235 stars 10 forks source link

Invalid Grant #58

Closed KatyPurry closed 1 year ago

KatyPurry commented 1 year ago

Hello,

I followed the how to, I downloaded Shreddit after installing Cargo. I tried to run in cli command but it returns an error :

  2023-06-08T20:36:35.653591Z DEBUG  No shreddit.env config file found.
    at C:\Users\alexa\.cargo\registry\src\index.crates.io-6f17d22bba15001f\shreddit-0.7.3\src\main.rs:34

  2023-06-08T20:36:35.815718Z ERROR  {"error":"invalid_grant"}
    at C:\Users\alexa\.cargo\registry\src\index.crates.io-6f17d22bba15001f\shreddit-0.7.3\src\main.rs:41

Error: "{\"error\":\"invalid_grant\"}"

Is it related to my reddit's nickname ? It's look like -username-. I added an \ to escape :\-username-

markjamesm commented 1 year ago

I'm receiving the same error, except I'm running the .exe directly. My username contains only letters.

2023-06-09T15:08:12.632712Z DEBUG  No shreddit.env config file found.
    at src\main.rs:34

2023-06-09T15:08:13.305680Z ERROR  {"error":"invalid_grant"}
    at src\main.rs:41

Attempting to do a dry run (with all my reddit parameters set) results in the following error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("www.reddit.com")), port: None, path: "/api/v1/access_token", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Os { code: 11001, kind: Uncategorized, message: "No such host is known." })) }', src\access_token.rs:21:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
stark1tty commented 1 year ago

Turn off 2FA and it should work.

JosephBrooksbank commented 1 year ago

FYI: This error will also occur if your user credentials (username/password) are incorrect.

andrewbanchich commented 1 year ago

@markjamesm The error you posted says it's a DNS error and "No such host is known" so I suspect there was some issue on your side with your DNS server.

andrewbanchich commented 1 year ago

For this invalid grant error, please look at the debug log output and verify your credentials are correct.

Are you creating the client ID and token correctly?

CarbonProp commented 1 year ago

I can confirm the same issue is happening here for me. How do i find the logs?

2023-06-10T12:19:11.172635Z DEBUG No shreddit.env config file found. at src\main.rs:34

2023-06-10T12:19:11.993024Z ERROR {"error":"invalid_grant"} at src\main.rs:41

Error: "{\"error\":\"invalid_grant\"}"

zcdziura commented 1 year ago

I've run into this issue before when trying to log into 3rd-party Reddit apps while having 2FA enabled.

What you have to do is append a colon (:) to the end of your password, followed by the TOTP value.

So, for example, if the current TOTP number in Google Authenticator is "123456", I would enter "--password MY_PASSWORD:123456"

I hope that helps!

Decoherent commented 1 year ago

I've run into this issue before when trying to log into 3rd-party Reddit apps while having 2FA enabled.

What you have to do is append a colon (:) to the end of your password, followed by the TOTP value.

So, for example, if the current TOTP number in Google Authenticator is "123456", I would enter "--password MY_PASSWORD:123456"

I hope that helps!

This is the solution, thanks much!

andrewbanchich commented 1 year ago

Updated the README to clarify this here.