Ah, yeah, coding the OAuth2 flow in a new language (vs using an existing library) is tricky, at the very least because OAuth2 itself is complex. The best docs I know for that are here https://developers.google.com/identity/protocols/OAuth2Servi... (we should link to it from the docs of the Cloud APIs).
From a glimpse, what's said there matches what your code is doing, so thanks a lot for sharing it!
From a glimpse, what's said there matches what your code is doing, so thanks a lot for sharing it!