From the TokenRequest line with which your application crashes, combined with the knowledge that in HTTP error code 400 means an invalid request, I would say that your problem is that your application is trying to send incorrectly formatted data or sending more / less data than expected.
In addition, the error you return tells you that you have "invalid_grant", so this should mean that the application received a response to the rejection of the server due to the fact that it was not privileged (registered) to do all that he is trying to do is your application, most likely due to an incorrect request error.
Reading a little more about the subject, others seem to have had similar problems.
invalid_grant is trying to get oAuth token from google
Their solution was to change client_id to an email address.
This seems to be a problem when the Google API is a mess.
From what I read, it seems that it will allow you to connect correctly for the first time, and then revoke the token for the session, sending back this error that you are currently receiving.
So, the first step you need to take is to replace client_id with the email address associated with the client ID.
source share