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?
@mtomczak It's the sandboxing going on. You can find the external IPs, but OAuth2 callbacks want to use 127.0.0.1. The workaround I used turned out to be to set Firefox (which doesn't have this problem, why?) as default long enough for the Android app to use it to authorize, then switch the default back to Chrome. I talked to the author of the app about this last night, and he now is considering using Webview directly in the app to avoid this whole issue, hopefully. Assuming Webview handles this better.
@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.