2021.06.28 TIL: ๐Ÿ‘ฃ๐Ÿ‘ฃ๐Ÿ‘ฃ๐Ÿ‘ฃ๊ฑธ์–ด๊ฐ€๋Š” ์ค‘

๊น€๋ณ‘๋ฏผยท2021๋…„ 6์›” 28์ผ
0

TIL

๋ชฉ๋ก ๋ณด๊ธฐ
23/68
post-thumbnail

Today I Learned!

์˜ค๋Š˜ ๋ฐฐ์šด ๊ฒƒ

  • ์ธ์ฆ ๋ณด์•ˆ
    • https
      • ngrok์˜ ์‚ฌ์šฉ
    • hashing/salt
    • cookie : ์„œ๋ฒ„๊ฐ€ ํด๋ผ์ด์–ธํŠธ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅ / ํด๋ผ์ด์–ธํŠธ์—์„œ ์„œ๋ฒ„๋กœ ์ฟ ํ‚ค๋ฅผ ์ „์†ก
    • session
app.use(
  session({
    secret: '@sdfdsfsfsdfsfsdfsd', //์•”ํ˜ธ์™€
    resave: false,
    saveUninitialized: true,
    cookie: { // ์ฟ ํ‚ค์„ค์ •
      domain: "localhost",
      path: "/",
      maxAge: 24 * 6 * 60 * 10000,
      sameSite: 'None',
      httpOnly: true,
      secure: true,
    },
  })
);
  • cors์˜ ์†์„ฑ๊ฐ’
const options = {
  origin: 'https://localhost:3000', // ์ ‘๊ทผ ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜๋Š” ๋„๋ฉ”์ธ
  credentials: true, // ์ถ”๊ฐ€ ์‘๋‹ต ํ—ค๋”๋กœ Access-Control-Allow-Credentials 
  //์˜ต์…˜๋„ ์„ค์ •ํ•ด์ฃผ์…”์•ผ ์ฟ ํ‚ค๊ฐ€ ์ „์†ก ํ”„๋ก ํŠธ์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ผ ๋•Œ axios.post(์ฃผ์†Œ, ๋ฐ์ดํ„ฐ, { withCredentials: true }); ์„ ํ•ด์ค˜์•ผ ์„œ๋กœ ๋‹ค๋ฅธ ๋„๋ฉ”์ธ ๊ฐ„ ์ฟ ํ‚ค ์ „์†ก์ด ๊ฐ€๋Šฅํ•ด์ง
  optionsSuccessStatus: 200, // ์‘๋‹ต ์ƒํƒœ 200์œผ๋กœ ์„ค์ • 
  methods: 'GET, POST, OPTIONS',
};
   

๋Š๋‚Œ์ 

session๊ณผ cookie, cors ... ์ง€์˜ฅ ์‚ผ์œ„์ผ์ฒด

  1. ๋งค์ผ 1์‹œ๊ฐ„ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ ํ’€๊ธฐ (inflearn, programers)
    section 7 8๋ฒˆ๊นŒ์ง€์™„๋ฃŒ

  2. NodeBird๋งŒ๋“ค๊ธฐ ์‹œ์ž‘
    1๊ฐ• ์™„๋ฃŒ

  3. ์ž๋ฃŒ๊ตฌ์กฐ ์ดํ•ด
    11ํŠธ ...

  4. session๊ณผ ์ฟ ํ‚ค ์Šคํ”„๋ฆฐํŠธ ๊ณต๋ถ€

์•Œ๋ฉด ์•Œ ์ˆ˜๋ก ํž˜๋“ค๊ณ  ์–ด๋ ต๊ณ  ์žฌ๋ฏธ๋‚œ ๊ฒƒ๊ฐ™๋‹ค.

ํ•˜ํ•˜ํ•˜ํ•˜ํ•˜ํ•˜

์—ด์‹ฌํžˆ ๋˜ ์—ด์‹ฌํžˆ ํ•˜์ž

ํ•  ์ˆ˜์žˆ์„๊ฑฐ๊ณ 

ํ•  ์ˆ˜์—†๋Š” ๊ฑด ํ•  ์ˆ˜์žˆ์„ ๋•Œ๊นŒ์ง€ ํ•˜๋ฉด ๋˜๋Š” ๊ฒƒ์ด๋‹ค.

๐Ÿ‘ฃ๐Ÿ‘ฃ๐Ÿ‘ฃ๐Ÿ‘ฃ

0๊ฐœ์˜ ๋Œ“๊ธ€