I have exhausted all efforts to integrate passport into my application without success. Every login attempt with various providers (Facebook, Google, Twitter, Microsoft) has resulted in an error message similar to this:
XMLHttpRequest cannot load https://www.google.com/accounts/o8/ud?openid.mode=checkid_setup&openid.ns=h…2F%2Ftest.sl%2Fauth%2Fgoogle%2Freturn&openid.realm=http%3A%2F%2Ftest.sl%2F.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://test.sl' is therefore not allowed access.
Despite the simplicity of my application, I continue facing issues. Here's a brief overview of my server-side code:
var express = require('express');
var ppGoogle = require('passport-google-oauth').OAuth2Strategy;
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(express.static(__dirname + '/public'));
// More configuration settings
app.listen(7230);
app.get('/auth/google', passport.authenticate('google'));
app.get('/auth/google/return', passport.authenticate('google', {
successRedirect: '/main',
failureRedirect: '/login'
}));
passport.use(new ppGoogle({
clientID: '',
clientSecret: '',
callbackURL: 'http://test.sl/auth/google/return'
},
function (accessToken, refreshToken, profile, done)
{
console.log('done');
}));
If anyone knows the solution to this problem, please help me out. It's really frustrating!