Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
6a8aef71
Unverified
Commit
6a8aef71
authored
May 02, 2020
by
Marcus Koh
Committed by
GitHub
May 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated with-firebase-authentication to fix errors (#12204)
parent
4624c09f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
index.js
examples/with-firebase-authentication/pages/index.js
+7
-3
server.js
examples/with-firebase-authentication/server.js
+1
-0
No files found.
examples/with-firebase-authentication/pages/index.js
View file @
6a8aef71
...
@@ -6,10 +6,14 @@ import 'isomorphic-unfetch'
...
@@ -6,10 +6,14 @@ import 'isomorphic-unfetch'
import
clientCredentials
from
'../credentials/client'
import
clientCredentials
from
'../credentials/client'
export
async
function
getServerSideProps
({
req
,
query
})
{
export
async
function
getServerSideProps
({
req
,
query
})
{
const
user
=
req
&&
req
.
session
?
req
.
session
.
decodedToken
:
null
const
user
=
req
.
session
&&
req
.
session
.
decodedToken
?
req
.
session
.
decodedToken
:
null
// don't fetch anything from firebase if the user is not found
// don't fetch anything from firebase if the user is not found
// const snap = user && await req.firebaseServer.database().ref('messages').once('value')
// const snapshot = user && (await req.firebaseServer.firestore().collection('messages').get())
// const messages = snap && snap.val()
// let messages = []
// snapshot.forEach(function(doc) {
// messages.push(doc.data())
// });
const
messages
=
null
const
messages
=
null
return
{
return
{
props
:
{
props
:
{
...
...
examples/with-firebase-authentication/server.js
View file @
6a8aef71
...
@@ -13,6 +13,7 @@ const handle = app.getRequestHandler()
...
@@ -13,6 +13,7 @@ const handle = app.getRequestHandler()
const
firebase
=
admin
.
initializeApp
(
const
firebase
=
admin
.
initializeApp
(
{
{
credential
:
admin
.
credential
.
cert
(
require
(
'./credentials/server'
)),
credential
:
admin
.
credential
.
cert
(
require
(
'./credentials/server'
)),
// databaseURL: "https://<YOUR_PROJECT>.firebaseio.com",
},
},
'server'
'server'
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment