My scenario is that I have an Android application which has a back-end server. I'm implementing the ability to sign in using Google as an alternative to setting up an account with specified credentials.
On the server side I am using LoopBack, which underneath uses the Node/Express Passport library for OAuth2. On the Android side I am using Google's modern Sign-In library.
The Android Sign-In library takes all care of prompting the user to choose a Google account to sign in with. Once this succeeds, the library provides me with a server auth token.
This server auth token may then be passed to /auth/google/callback?token=... at my back-end, which then logs me in.
So far, all of this works to an extent. So far, my back-end runs on my development machine. In the Google API console, the callback URI for the OAuth2 key points to http://localhost:3000/auth/google/callback. Specifically, on my Android app, I successfully get an auth token. If I manually paste this into Postman running on my development machine to GET to http://localhost:3000/auth/google/callback it successfully authenticates. However, if I attempt to complete the final piece of the puzzle such that the app itself passes the token to the server application, a redirect URI mismatch error occurs. This, I can only assume, is because the HTTP request from Postman on the same machine contains 'localhost' in the host header. But a request from anything else has the machine's LAN IP in the host header.
Firstly, although I generally understand the OAuth2 flow and I understand that the purpose of the callback is for Google's server itself to deliver an auth token back to your server in the context of a web application, what I don't fully understand is the relevance of the callback URI in the case where an application receives the auth token and then performs the task of passing the token to the back-ends callback URI itself.
Secondly, how can I successfully pass the auth token to my development server and authenticate successfully? The Google API console will allow me to specify localhost, but obviously not a LAN IP.