質問編集履歴
2
修正依頼対応
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,6 +10,10 @@
|
|
10
10
|
|
11
11
|
どのようにすればCookieをサーバ側へ送信できるのかご教授願いたいです。
|
12
12
|
|
13
|
+
環境
|
14
|
+
OS: macOS Sierra 10.12.1
|
15
|
+
ブラウザ: Chrome バージョン: 67.0.3396.87
|
16
|
+
|
13
17
|
ソースコードは下記のようになります。
|
14
18
|
|
15
19
|
クライアント側 (localhost:9000)
|
@@ -55,7 +59,7 @@
|
|
55
59
|
const expiresIn = 60 * 60 * 24 * 5 * 1000;
|
56
60
|
admin.auth().createSessionCookie(idToken, {expiresIn}).then((sessionCookie) => {
|
57
61
|
// Set cookie policy for session cookie.
|
58
|
-
const options = {maxAge: expiresIn, httpOnly: true, secure: true};
|
62
|
+
const options = {domain: 'localhost', maxAge: expiresIn, httpOnly: true, secure: true};
|
59
63
|
res.cookie('session', sessionCookie, options);
|
60
64
|
res.end(JSON.stringify({status: 'success'}));
|
61
65
|
}, error => {
|
1
不足部分の補填
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
クロスドメインにてレスポンスで返るCookie
|
1
|
+
クロスドメインにてレスポンスで返るSet-Cookieが次回リクエスト時にCookieとしてセットされない
|
body
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
ソースコードは下記のようになります。
|
14
14
|
|
15
|
-
クライアント側
|
15
|
+
クライアント側 (localhost:9000)
|
16
16
|
|
17
17
|
```
|
18
18
|
axios.defaults.withCredentials = true;
|
@@ -32,6 +32,7 @@
|
|
32
32
|
})
|
33
33
|
```
|
34
34
|
|
35
|
+
サーバ側 (localhost:3000)
|
35
36
|
|
36
37
|
```
|
37
38
|
var app = express();
|