Home > OS >  DNS_PROBE_FINISHED_NXDOMAIN while using EC2 for Google OAuth
DNS_PROBE_FINISHED_NXDOMAIN while using EC2 for Google OAuth

Time:12-03

I am getting DNS_PROBE_FINISHED_NXDOMAIN while using an ubuntu EC2 instance for my google OAuth2.0 strategy using Google API platform.

After selecting the desired GMAIL Account for Auth, the /google/callback is not working and returning DNS_PROBE_FINISHED_NXDOMAIN

app.get("/google/callback", 
passport.authenticate('google', {
    successRedirect: "---ec2 url----",
    failureRedirect: '/authfailure'
}),
) 

I am picking ec2 url from .env in EC2. Please have a look at https://github.com/shubham9919/OAuth2.0IMPL for the code.

Thanks.

CodePudding user response:

I was getting this problem because google dont want to resolve any non static public IP for its authentication. To dumb it down, The EC2 instance I am using is not attached to any elastic IP and hence IP is not owned by me. In case I stop and start my instance, I will loose my previous IP and google may start sending callbacks to some other server owning that IP. This could be a reason behind not allowing such IPs for callback authentication.

For Resolution, we can use:

{IP}.nip.io:{port}/google/callback 

Resolved my problem. suppose our IP is 172.4.5.6

172.4.5.6.nip.io:5000/google/callback resolves to => 172.4.5.6:5000/google/callback

This is not advisible in the production environment but can be a possible solution in development phase.

  • Related