I have no idea why this is happening. We finally launched our app, everything works on the staging server, and then I deploy to an identical setup - and now this is happening - and I can’t figure out for the life of me WHY… I’ve tried everything.
You can see it happening for yourself: go to http://www.crunchyserial.com/
Here is the error in the console:
Uncaught DOMException: Blocked a frame with origin "http://www.crunchyserial.com" from accessing a cross-origin frame.
at http://www.crunchyserial.com/packages/oauth/end_of_popup_response.js:18:39
at http://www.crunchyserial.com/packages/oauth/end_of_popup_response.js:37:3
Here is the settings.json
I use in my ./deploy
directory for the production server:
{
"public": {
"analyticsSettings": {
"Google Analytics" : {"trackingId": "//redacted//"}
}
},
"private": {
"oAuth": {
"google": {
"clientId": "//redacted//",
"secret": "//redacted//",
"loginStyle": "popup"
},
"facebook": {
"appId": "//redacted//",
"secret": "//redacted//",
"loginStyle": "popup"
},
"twitter": {
"consumerKey": "//redacted//",
"secret": "//redacted//"
"loginStyle": "popup"
}
}
}
Oddly enough - there seems to be no difference between “popup” and “redirect” as the loginStyle… curious…
This is my mup.js
:
module.exports = {
servers: {
one: {
host: '//redacted//',
username: 'ubuntu',
pem: "//redacted//"
// password:
// or leave blank for authenticate from ssh-agent
}
},
meteor: {
name: 'CrunchySerial',
path: '../../CrunchySerial',
servers: {
one: {}
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: 'http://www.crunchyserial.com',
MONGO_URL: 'mongodb://localhost/meteor'
},
dockerImage: 'abernix/meteord:base',
deployCheckWaitTime: 400
},
mongo: {
oplog: true,
port: //redacted//,
servers: {
one: {},
},
},
};
I’ve tried the ROOT_URL with and without a /
I’ve updated to all the latest versions… And I still have no idea why this is happening.
ANY help would be greatly appreciated. I’m willing to try anything at this point - we have a hard launch date tomorrow, and if this doesn’t work we’re just going to have to abandon the single-signon/oauth issue.
Solution:
Your oauth script will only work from one domain - and when you have a ROOT_URL, it uses this in the uri that your oauth certs need to work properly. So oauth will only work from ONE subdomain. You have to pick www or no-www. I chose to keep www and setup both a DNS redirect, and a programmatic redirect (just to be sure).
Here is my programmatic redirect:
//[project]/imports/startup/client/force_www_redirect.js
import { Meteor } from 'meteor/meteor'
Meteor.startup(function () {
if (location.host.indexOf('www.crunchyserial.com') !== 0) {
location = 'http://www.crunchyserial.com'
}
})
and I just make sure this is the first code my client startup sees by importing it first.