dyreschlock / schlock-website

Personal Website code to be run locally or generate a static website hosted through github pages.
http://theschlock.com/
0 stars 0 forks source link

Receiving 400 when getting Google IDs #51

Closed dyreschlock closed 1 year ago

dyreschlock commented 1 year ago

For some reason, when using the Google Drive API, I'm getting a 400 error.

400 Bad Request POST https://oauth2.googleapis.com/token { "error": "invalid_grant", "error_description": "Bad Request" }

dyreschlock commented 1 year ago

From what I can tell, the reason this was happening was because the login credentials grew stale. Those credentials were stored in /tokens and generated by the FileDataStoreFactory. I could not figure out how to log out of that session or update the log in so it'll allow me to continue.

So, I changed the datastore to a MemoryDataStoreFactory. This requires that the user logs into Google every time. This is probably a good idea anyway rather than having a credentials file laying around.