nicholastay / passport-discord

Passport strategy for authentication with Discord (discordapp.com)
ISC License
172 stars 55 forks source link

The Cookie is not applying to Front-end website #39

Open CutieCat6778 opened 3 years ago

CutieCat6778 commented 3 years ago

I have 2 applications, 1 is for backend application and another is for front-end

so when I run those 2 applications on local the cookies seem very normal and no problem with running. But when I deploy it to Production, the cookie on the front-end application didn't show up! But the backend one is still normal. So my question is where did I made a mistake? Because on the Local runs very normal

const router = require('express').Router();
const passport = require('passport');

router.get('/discord', passport.authenticate('discord'));

router.get('/discord/redirect', passport.authenticate('discord', { failureRedirect: '/api/auth/' }), (req, res, next) => {
    res.redirect(process.env.URL); //https://noobteam.ga
})
FC5570 commented 2 years ago

Did you manage to fix this @CutieCat6778? I'm having the same issue.

CutieCat6778 commented 2 years ago

Did you manage to fix this @CutieCat6778? I'm having the same issue.

Hey! Well I fixed it, because my back-end domain and front-end domain is kinda complicated. My old url was somedomainforbackend.com and somedomainforfrontend.com to dev.domain.com and domain.com, so the passport can apply cookies. Btw you have to change at the cors too. The cross something.... Sorry, I don't remember.

FC5570 commented 2 years ago

ah ok. thanks @CutieCat6778