This is the kind of #Google "support" page that drives me nuts. Note 156 people asking the same question, but it was just immediately locked with a useless "ask it over somewhere else" response. So typical. - https://support.google.com/chromebook/thread/50901565/how-to-access-localhost-from-chrome-browser-to-android-webserver?hl=en (And no, I can't find an answer anywhere else.)
And for what it's worth, I figured out a workaround for the situation. Essentially, it appears that for some bizarre reason, Chrome has problems with this, but Firefox doesn't. So, install Firefox on Chromebook from Play Store. Switch Firefox to be default browser. Do the OAuth via Firefox. Switch default back to Chrome. Interesting.
@lauren Huh. I wonder why Chrome on a Chromebook can't access its own localhost ports?
@lauren Oh, because it's got an Android environment and that environment isn't necessarily publishing an interface to the TCP stack the Chrome app is running in; now I follow.
I love Chromebook for the benefits of the isolation, but it does make it tricky / confusing to do anything even remotely complex on it. We've looked into it as a platform for developing FIRST Robotics machines in the past, and the consensus continues to be "The security model actively gets in the way of developing mobile robotics software."
@lauren Ooh, I hadn't thought about that. Yeah, that suggests some shenanigans.
I wonder if Chrome itself (being both the browser and the OS) has a funny notion of the TCP stack relative to other apps on the Chromebook? Like... Maybe Chrome is outside a shared Android / other-app sandbox?
I really have no idea on this one.
@mtomczak What I don't understand is why on the Chromebook, launched from an Android app, Chrome browser can't handle this situation properly but Firefox does. A puzzlement.