I encountered the same issue. It turns out that the Authorization Code live time is 5 minutes. When testing, it's expired. After redo the authorization and new code. The invalid_grant went away. Hope this helps others.