質問編集履歴
7
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -407,3 +407,5 @@
|
|
407
407
|
![エラー](c1cbda78e1f902ee5c2edae3e83701c4.png)
|
408
408
|
|
409
409
|
![イメージ説明](798fb8ca411d960969cb0fd019b8fcc1.png)
|
410
|
+
|
411
|
+
![イメージ説明](6e0b977829e7b9f4c39e09299f0e42b5.png)
|
6
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -294,6 +294,8 @@
|
|
294
294
|
|
295
295
|
```
|
296
296
|
|
297
|
+
next.config.js
|
298
|
+
|
297
299
|
import Head from 'next/head'
|
298
300
|
|
299
301
|
import { useEffect } from 'react'
|
5
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -404,4 +404,4 @@
|
|
404
404
|
|
405
405
|
![エラー](c1cbda78e1f902ee5c2edae3e83701c4.png)
|
406
406
|
|
407
|
-
![イメージ説明](
|
407
|
+
![イメージ説明](798fb8ca411d960969cb0fd019b8fcc1.png)
|
4
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,13 +32,9 @@
|
|
32
32
|
|
33
33
|
APIキーが正しいことは確認したのですがなぜか解決せず、
|
34
34
|
|
35
|
-
|
35
|
+
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
|
40
|
-
|
41
|
-
|
37
|
+
|
42
38
|
|
43
39
|
|
44
40
|
|
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -407,3 +407,5 @@
|
|
407
407
|
|
408
408
|
|
409
409
|
![エラー](c1cbda78e1f902ee5c2edae3e83701c4.png)
|
410
|
+
|
411
|
+
![イメージ説明](bf4ac8eb28783a628ae7df867ca455c1.png)
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,6 +36,12 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
+
console.logで値は取れました!
|
40
|
+
|
41
|
+
問題のauth.jsではなくindex.jsですけど
|
42
|
+
|
43
|
+
|
44
|
+
|
39
45
|
### 該当のソースコード
|
40
46
|
|
41
47
|
|
@@ -290,8 +296,114 @@
|
|
290
296
|
|
291
297
|
|
292
298
|
|
299
|
+
```
|
300
|
+
|
301
|
+
import Head from 'next/head'
|
302
|
+
|
303
|
+
import { useEffect } from 'react'
|
304
|
+
|
305
|
+
import { useUser } from '../context/userContext'
|
306
|
+
|
307
|
+
import firebase from '../firebase/clientApp'
|
308
|
+
|
309
|
+
import Link from 'next/link'
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
require('dotenv').config();
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
const value = process.env.NEXT_PUBLIC_FIREBASE_API_KEY;コンソールで出力
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
console.log(value);
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
export default function Home() {
|
326
|
+
|
327
|
+
// Our custom hook to get context values
|
328
|
+
|
329
|
+
const { loadingUser, user } = useUser()
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
useEffect(() => {
|
334
|
+
|
335
|
+
if (!loadingUser) {
|
336
|
+
|
337
|
+
// You know that the user is loaded: either logged in or out!
|
338
|
+
|
339
|
+
console.log('user:', user)
|
340
|
+
|
341
|
+
}
|
342
|
+
|
343
|
+
// You also have your firebase app initialized
|
344
|
+
|
345
|
+
console.log('firebase:', firebase)
|
346
|
+
|
347
|
+
}, [loadingUser, user])
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
return (
|
352
|
+
|
353
|
+
<div className="container">
|
354
|
+
|
355
|
+
<Head>
|
356
|
+
|
357
|
+
<title>Next.js w/ Firebase Client-Side</title>
|
358
|
+
|
359
|
+
<link rel="icon" href="/favicon.ico" />
|
360
|
+
|
361
|
+
</Head>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
<Link href="./auth">
|
366
|
+
|
367
|
+
<a>auth</a>
|
368
|
+
|
369
|
+
</Link>
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
<main>
|
374
|
+
|
375
|
+
<h1 className="title">Next.js w/ Firebase Client-Side</h1>
|
376
|
+
|
377
|
+
<p className="description">Fill in your credentials to get started</p>
|
378
|
+
|
379
|
+
<div>currentUser:{user}</div>
|
380
|
+
|
381
|
+
</main>
|
382
|
+
|
383
|
+
<script src="https://www.gstatic.com/firebasejs/7.19.1/firebase-app.js"></script>
|
384
|
+
|
385
|
+
<script src="/__/firebase/7.18.0/firebase-installations.js"></script>
|
386
|
+
|
387
|
+
<script src="https://www.gstatic.com/firebasejs/7.19.1/firebase-analytics.js"></script>
|
388
|
+
|
389
|
+
<script src="/__/firebase/init.js"></script>
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
</div>
|
396
|
+
|
397
|
+
)
|
398
|
+
|
399
|
+
}
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
```
|
404
|
+
|
293
405
|
![エラー画面](c4adc57371212b7ea84e3846b488f6e7.png)
|
294
406
|
|
295
407
|
|
296
408
|
|
297
|
-
![
|
409
|
+
![エラー](c1cbda78e1f902ee5c2edae3e83701c4.png)
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,6 +18,12 @@
|
|
18
18
|
|
19
19
|
```
|
20
20
|
|
21
|
+
Warning: Firebase is already defined in the global scope. Please make sure
|
22
|
+
|
23
|
+
Firebase library is only loaded once.
|
24
|
+
|
25
|
+
|
26
|
+
|
21
27
|
react_devtools_backend.js:2273 FirebaseError: Installations: Create Installation request failed with error "400 INVALID_ARGUMENT: API key not valid. Please pass a valid API key."
|
22
28
|
|
23
29
|
```
|