How to set a proxy server between my web app and google response, with out using third party support?

Viewed 17

In my app, I have implemented a feature "Sign In With Google" option, in which I am using a google mail id to authenticate the user to my app. the workflow goes like this

User presses the google button, and a page shows up to choose the Gmail id After choosing and logging in to the Gmail id, google authenticate the user, and send the data(name, email,...) of the Gmail user logged in. As the data will only be sent to a specific top-level domain that I am updated in the google console control panel, but by default, the localhost and the loopback(127.0.0.1) address are authorized automatically.

<div id="g_id_onload"
 data-client_id="769060092006-p1547n4dn7fbtua9jlt4qqreh9qq732g.apps.googleusercontent.com"
 data-context="signin"
 data-ux_mode="redirect"
 data-auto_prompt="false"
 data-login_uri ="http://localhost:8080/chat/Googledata.jsp">
</div>

<div class="g_id_signin"
 data-type="standard"
 data-shape="pill"
 data-theme="outline"
 data-text="signin_with"
 data-size="medium"
 data-logo_alignment="left">
</div>

i have to modify my app so that anyone can access my app with an IP address or hostname when connected to the same network, yes my app works fine if it is accessed in that way, but the google sign in button is not working, as the data will only be sent to the localhost or loopback address, but I can't specify the IP address in the google console control panel. I have tried various methods, and third-party support like ngrok, nip.io, etc. but it is not the solution, then i finally found me the exact requirement i want..

The app has to be unhosted, i.e, within the local network. The app has to work within the local network if the app is unhosted and portable. No third party can be used. Google implies certain conditions for reply URLs and the requirement is to support hostname and dynamic IPs so that google can support google auth in the unhosted app and find a concept to bridge these conditions. "try to understand the ngrok networking and apply it here to have your solution"

and I have studied and researched some networking concepts and tried to create a reverse SSH tunnel between google and the app and it didn't work. Finally, I came to know i have set a a reverse proxy server between my app and google. the exact words are "develop a solution to proxy the google response to your app Google -> Proxy server -> App" I completely studied the proxy concepts, theoretically but I don't know how to implement this, for my problem statement. how can i work on it?The google console api

0 Answers
Related