Home > front end >  Facebook login : Cannot load URL error coming when requesting access token from code?
Facebook login : Cannot load URL error coming when requesting access token from code?

Time:01-26

I am implementing Facebook login and I was successful to do so. The app worked great for a month but for the past 2-3 days I am getting the error message "Cannot load URL: The domain of this URL does not include the domain of the application. To be able to load this URL, add all domains and subdomains of your application to the Application Domain field in your application settings" when I try to make call for an access token from code. The app is a server-side nodejs app currently in development so I don't have any domain yet.

Access Token call (used to work perfectly before few days)

const { data } = await axios({
            url: "https://graph.facebook.com/v12.0/oauth/access_token",
            method: "GET",
            params: {
                client_id: keys.APP_ID_GOES_HERE,
                client_secret: keys.APP_SECRET_GOES_HERE,
                redirect_uri: callBackUrl,
                code,
            },
        });

App settings (In the app domain field, the domain is localhost. basic fields like name and email are filled others are empty) (please click on the link to view image) Facebook app setting. In the app domain field, the domain is localhost. basic fields like name and email are filled others are empty

Facebook login settings (please click on the link to view image) Client OAuth login, Web OAuth login, Enforce HTTPS, Use Strict Mode for redirect URIs fields are enabled and rest are disabled or left empty

CodePudding user response:

I am facing the same problem. After looking around I couldn't find anything. So I reached out to the facebook developers support. And turns out somebody reported this issue a few days ago and it is a bug that they are working on.

this bug is specifically related to the following:

  1. Previously you could add http://localhost:<PORT> to your Valid OAuth Redirect URIs in facebook app settings. Facebook changed it so that now when you have an app in dev mode the localhost is already allowed(or is supposed to be allowed rather). But, the bug is that even-though you keep your app in dev mode it still does not allow localhost.

  2. And you cannot add it manually to the Valid OAuth Redirect URIs.

so we are pretty much out of options until they fix this.

  •  Tags:  
  • Related