Q: SSL is blocking login with Passport in production, fully working on localhost I've built a small authentication app with Passport. It works just fine on localhost, which by the way is insecure. But on my domain, with Cloudflare SSL I'm not sure what's going on, I can't reach consent screen with Google and GitHub strategies. I don't have much knowledge about ssl certificate and want to know what part is wrong on my server.
I have added app.set('trust proxy'), app.use(cors()), set 'proxy: true' in both strategies.
Here is the relevant part of the code and the live code on my domain https://authapp.mambaoro.com
In index.js
app.set('trust proxy', 1);
app.use(cors());
app.use(
session({
secret: process.env.SESSION_KEY_1,
proxy: true,
saveUninitialized: false,
resave: false,
maxAge: 6.048e8,
}),
);
app.use(passport.initialize());
app.use(passport.session());
app.use('/auth', authRoutes);

app.get('/getUser', (req, res) => {
 if (!req.user) {
  return res.send({ isAuthenticated: false });
 }
 res.send(req.user);
});

In passport-setup.js
passport.use(
new GoogleStrategy(
{
  clientID: process.env.GOOGLE_CLIENT_ID,
  clientSecret: process.env.GOOGLE_CLIENT_SECRET,
  callbackURL: process.env.GOOGLE_CALLBACK_URL,
  proxy: true,
},
async (accesToken, refreshToken, profile, done) => {
  try {
    await User.sync();
    const newUser = await User.findOrCreate({
      where: {
        googleId: profile.id,
        username: profile.displayName,
        profileImageUrl: profile.photos[0].value,
      },
    });
    done(null, newUser[0]);
  } catch (e) {
    done(e);
      }
    },
   ),
  );

 passport.use(
  new GithubStrategy(
   {
    clientID: process.env.GITHUB_CLIENT_ID,
    clientSecret: process.env.GITHUB_CLIENT_SECRET,
    callbackURL: process.env.GITHUB_CALLBACK_URL,
    proxy: true,
   },
  async (accessToken, refreshToken, profile, done) => {
   try {
    await User.sync();
    const newUser = await User.findOrCreate({
      where: {
        githubId: profile.id,
        username: profile.username,
        profileImageUrl: profile.photos[0].value,
      },
    });
    done(null, newUser[0]);
  } catch (e) {
    done(e);
      }
    },
  ),
);

In auth-routes.js
// auth with google
router.get(
 '/google',
 passport.authenticate('google', {
  scope: ['profile'],
 }),

);
// auth with github
router.get('/github', passport.authenticate('github', { scope: 
 ['profile'] }));

In index.js On the client with React, the code below is used to get the user details with Passport if a cookie exists.
function SignUser() {
 const [user, setUserData] = useState(null);
 const [isAuthenticated, setIsAuth] = useState(false);
 useEffect(() => {
  const getUser = async () => {
  const res = await axios.get('/getUser');
  res.data.user && setUserData(res.data.user);
  res.data.isAuthenticated && setIsAuth(true);
 };
 getUser();
 }, []);
 ...

