質問編集履歴

1

試してみたことの記載

2020/07/06 00:36

投稿

dbrow
dbrow

スコア18

test CHANGED
@@ -1 +1 @@
1
- firebaseの認証機能実装中エラー( ERR_ABORTED 404)
1
+ firebaseの認証機能でログイン成功後、リダイレクト先URLに飛ばない
test CHANGED
@@ -10,6 +10,166 @@
10
10
 
11
11
 
12
12
 
13
+ ### 試したこととのその結果
14
+
15
+ いくつかのコードが重複していたので、そちらを削除した結果、404エラーは出なくなりましたが、リダイレクト先のURLへ飛ばないことは変わっていない状況です。
16
+
17
+
18
+
19
+ ### 変更後のソースコード
20
+
21
+ ```ここに言語を入力
22
+
23
+ <!DOCTYPE html>
24
+
25
+ <html lang="ja">
26
+
27
+
28
+
29
+ <head>
30
+
31
+ <meta charset="utf-8">
32
+
33
+ <title>HERE MAP</title>
34
+
35
+
36
+
37
+ <script src="https://www.gstatic.com/firebasejs/4.10.1/firebase-app.js"></script>
38
+
39
+ <script src="https://www.gstatic.com/firebasejs/4.10.1/firebase-auth.js"></script>
40
+
41
+
42
+
43
+ <script src="https://cdn.firebase.com/libs/firebaseui/2.5.1/firebaseui.js"></script>
44
+
45
+ <link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/2.5.1/firebaseui.css" />
46
+
47
+
48
+
49
+ <!-- Initialize Firebase -->
50
+
51
+ <script>
52
+
53
+ var config = {
54
+
55
+ apiKey: "xxx",
56
+
57
+ authDomain: "yyy.firebaseapp.com",
58
+
59
+ databaseURL: "https://yyy.firebaseio.com",
60
+
61
+ projectId: "yyy",
62
+
63
+ storageBucket: "yyy.appspot.com",
64
+
65
+ //messagingSenderId: "sender-id",
66
+
67
+ //appID: "zzz",
68
+
69
+ };
70
+
71
+ firebase.initializeApp(config);
72
+
73
+
74
+
75
+
76
+
77
+ var ui = new firebaseui.auth.AuthUI(firebase.auth());
78
+
79
+
80
+
81
+ var uiConfig = {
82
+
83
+ callbacks: {
84
+
85
+ signInSuccessWithAuthResult: function(authResult, redirectUrl) {
86
+
87
+ // User successfully signed in.
88
+
89
+ // Return type determines whether we continue the redirect automatically
90
+
91
+ // or whether we leave that to developer to handle.
92
+
93
+ return true;
94
+
95
+ },
96
+
97
+ uiShown: function() {
98
+
99
+ // The widget is rendered.
100
+
101
+ // Hide the loader.
102
+
103
+ document.getElementById('loader').style.display = 'none';
104
+
105
+ }
106
+
107
+ },
108
+
109
+ // Will use popup for IDP Providers sign-in flow instead of the default, redirect.
110
+
111
+ signInFlow: 'popup',
112
+
113
+ signInSuccessUrl: 'https://www.nikkei.com/',
114
+
115
+ signInOptions: [
116
+
117
+ // Leave the lines as is for the providers you want to offer your users.
118
+
119
+ firebase.auth.EmailAuthProvider.PROVIDER_ID,
120
+
121
+ ],
122
+
123
+ };
124
+
125
+
126
+
127
+ // FirebaseUI描画
128
+
129
+ ui.start('#firebaseui-auth-container', uiConfig);
130
+
131
+
132
+
133
+ </script>
134
+
135
+
136
+
137
+ </head>
138
+
139
+
140
+
141
+ <body>
142
+
143
+
144
+
145
+ <div id="firebaseui-auth-container"></div>
146
+
147
+ <script src="https://www.gstatic.com/firebasejs/5.8.1/firebase-app.js"></script>
148
+
149
+ <script src="https://www.gstatic.com/firebasejs/5.8.1/firebase-auth.js"></script>
150
+
151
+ <script src="https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth__ja.js"></script>
152
+
153
+ <script>
154
+
155
+ ui.start('#firebaseui-auth-container', uiConfig);
156
+
157
+ </script>
158
+
159
+
160
+
161
+ </body>
162
+
163
+
164
+
165
+ </html>
166
+
167
+ ```
168
+
169
+
170
+
171
+
172
+
13
173
  ### エラーメッセージ
14
174
 
15
175
  検証ツールで見ると以下のようなエラーが出ていました。