Safari无法打开页面“localhost:8080 / auth / facebook / callback?

时间:2017-10-10 09:04:33

标签: safari facebook-login facebook-oauth

我在localhost工作的应用程序。但在制作中,当通过facebook订阅时,它会显示以下错误:

  

Safari无法打开“localhost:8080 / auth / facebook / callback?

页面

2 个答案:

答案 0 :(得分:0)

浏览器安全策略阻止远程页面访问在localhost上运行的HTTP服务器。

要解决此问题,请使用服务器的公共主机名(FQDN),并确保可以从外部访问您的应用程序。

答案 1 :(得分:0)

我如何添加公共主机名!

 'use strict';
    /*eslint no-process-env:0*/

    import path from 'path';
    import _ from 'lodash';

    /*function requiredProcessEnv(name) {
      if(!process.env[name]) {
        throw new Error('You must set the ' + name + ' environment variable');
      }
      return process.env[name];
    }*/

    // All configurations will extend these options
    // ============================================
    var all = {
      env: process.env.NODE_ENV,

      // Root path of server
      root: path.normalize(`${__dirname}/../../..`),

      // Browser-sync port
      browserSyncPort: process.env.BROWSER_SYNC_PORT || 8080,

      // Server port
      port: process.env.PORT || 8080,

      // Server IP
      ip: process.env.IP || '0.0.0.0',

      // Should we populate the DB with sample data?
      seedDB: false,

      // Secret for session, you will want to change this and make it an environment variable
      secrets: {
        session: 'azertysoft.com'
      },

      // MongoDB connection options
      mongo: {
        options: {
          db: {
            safe: true
          }
        }
      },


      facebook: {
        clientID: process.env.FACEBOOK_ID || '167..57940',
        clientSecret: process.env.FACEBOOK_SECRET || '748efa9d9a...a8a0364',
        callbackURL: (process.env.domain || '') + '/auth/facebook/callback'
    /*
        callbackURL: 'ppollit.azertysoft.com/auth/facebook/callback'
    */
      },

      twitter: {
        clientID: process.env.TWITTER_ID || 'dDp8Hd...HV0t0W2c',
        clientSecret: process.env.TWITTER_SECRET || 'aFA7...z9AwfbJqXZ61GqkP',
        callbackURL: (process.env.domain || '') + '/auth/twitter/callback'
      },

  google: {
    clientID: process.env.GOOGLE_ID || '964...472168-jk3eu7aohfik6njj46u1...pps.googleusercontent.com',
    clientSecret: process.env.GOOGLE_SECRET || 'Void0kcp237F7Skt9Jpfg6_C',
    callbackURL: (process.env.DOMAIN || '') + '/auth/google/callback',
    client_id: 'AIzaSyBu...NHSl-XAxbBbkls'
  }
};

// Export the config object based on the NODE_ENV
// ==============================================
module.exports = _.merge(
  all,
  require('./shared'),
  require(`./${process.env.NODE_ENV}.js`) || {});

    enter code here