If like me, you got a prawcore.exceptions.OAuthException: invalid_grant error processing request
error out of the blue for your reddit bot that had been running without an issue for years on AWS Lambda, then maybe like me you also enabled 2FA on your Reddit account recently and failed to realize that the change would affect your reddit bot too since it authenticates to Reddit using your credentials.
To the best of my knowledge, reddit doesn't have 'App Passwords' like Google does so you'll have to find a way to supply the OTP code every time you authenticate to Reddit using PRAW.
Thanks to this pull request, prawcore
can now accept 2FA codes for ScriptAuthorizer
via a callback function.
To get the OTP code, you can use [pyotp](https://pypi.org/project/pyot