Facebook Oauth redirects to IP address instead of domain name

May 14, 2018 412 views
DigitalOcean Ubuntu 16.04

Hi all,

I'm having an issue when I try to log into Facebook using Oauth.

When I'm confirmed logged in, it wants to redirect me to my Digital Ocean IP address instead of the hostname (where it originally came from.) Here is the error I'm getting :

URL Blocked: This redirect failed because the redirect URI is not whitelisted 
in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login 
are on and add all your app domains as Valid OAuth Redirect URIs.

This error means I need to add the redirect URI to my Facebook Developers App, but I want it to redirect to my URL hostname and not my IP address. I tried fixing it on the Facebook side but no luck, so I'm thinking it might be a Digital Ocean issue.

The link is a screenshot of the error / URL address bar.

https://i.imgur.com/4WUHbrF.png

Any ideas?
Keith

2 Answers

@keithj0nes

You cannot use IP addresses to redirect to them you need to use domain names or sub-domains.

Please check here

I hope this helps.

Welp, I'm an idiot. I spent around 3 hours trying to figure out this problem, and of course figured it out RIGHT AFTER I posted this question.

It had to do with my passport.js file using the IP address as a callbackURL for the Facebook Strategy that I had set months ago. It was working just fine.

If I could figure out how to delete this thread, I would! Sorry for the false alarm!

Have another answer? Share your knowledge.