Reference to discussion https://github.com/vercel/next.js/discussions/16010
Bug fixes to `with-firebase-authentication` example that enter in a loop `maximum update depth exceeded errors` becase of the `onIdTokenChanged` Firebase auth method.
I added a clean up event listener.
I noticed a problem with the example - when you leave it logged in for more than an hour it breaks. The example API call starts to fail with `auth/id-token-expired`.
Looking at the code I saw that we never update the id token after signing in, but firebase automatically updates it every hour, meaning our `verifyIdToken` fails after an hour.
So I used the `onIdTokenChanged` function from firebase to update the cookie every time the id token changes.
I'm open to suggestions on refactoring the code I've added.
UPDATE I ADDED:
setUser()
AFTER REMOVING cookie IN return STATEMENT OF logout ARROW FUNCTION
There might be some cases where you do not want to redirect users after logout rather let them remain in that same page BUT let them know they have logged out by some UI changes .
For that cases you might need the 'user' hook to update when users logs out .
CURRENTLY the 'user' hook DOES NOT UPDATE AUTOMATICALLY when the user logs out .
PAGE REFRESH NEEDED to update that.
So i propose that we might add setUser() to update user so that user never returns true until user is set some value again
Prefixed variables name with NEXT_PUBLIC_.
Solving #13585 issue related to get undefined from process.env.VARNAME inside .env* files.
I'm not secure if SESSION_SECRET_* need the prefix.
Again, related to [12964](https://github.com/zeit/next.js/issues/12964)
After checking all the other examples and the ongoing pull requests, I believe that with this PR being merged, all the examples should be free of redundant react imports.
Let me know if you want me to edit anything that you don't like.
Regards
with-typescript
with-atstroturf
with-atlaskit
with-styletron
with-styled-components-rtl
with-stylesheet
with-stomp
with-stitches-styled
with-stitches
with-slate
with-sentry-simple
with-sentry
with-segment-analytics
with-rematch
with-relay-modern
with-reflux
with-redux-wrapper
with-react-relay-network
with-react-native
with-react-multi-carousel
with-react-jss
with-react-helmet
with-react-ga
with-quill-js
with-prefetching
with-google-analytics-amp
with-google-analytics
with-framer-motion
with-flow
with-firebase-hosting
with-firebase-cloud-messaging
with-firebase-authentication
with-expo
with-dynamic-app-layout
with-draft-js
with-cxs
with-cerebral
with-ant-design-mobile
with-algolia-react-instantsearch
using-preact
progressive-render
* Find/Replace "Deploy it to the cloud..."
* Find/Replace "Deploy it to the cloud..." (no colon)
* Find/Replace "Deploy it to the cloud..." for firebase
* Convert remaining ones
* Storybook deployment
* Update with-stripe-typescript
* Update contributing.md
* Remove `now`
* Update examples/with-stripe-typescript/README.md
Co-Authored-By: Luis Alvarez D. <luis@zeit.co>
* [with-firebase-authentication] remove deprecated warning
* [with-firebase-authentication] improve client and server credentials example
* [with-firebase-authentication] fix typo in the docs
* Add sessions folder to prevent errors on first run
* Update readme steps to reflect current firebase ui
* Use default directory for sessions-file-store
* Remove obsolete databaseURL from config
### changes
#### remove trailing spaces
When I was using example I noticed trailing spaces.
So, this PR removes the trailing spaces of json file, README, and others.
`examples/with-jest-typescript/src/modules/cars/Overview.tsx` also has it, but this time it did not change as tslint error occurs at commit.
I wrote a [script](https://github.com/j0lv3r4/dependency-version-updater) to update dependencies recursively in `package.json` files, e.g.:
```
$ node index.js --path="./examples" --dependencies="react=^16.7.0,react-dom=^16.7.0"
```
This PR contains the result against the examples folder.
Google seems to be deprecated the legacy realtime database and moving towards default use of Firestore, although it's still officially in beta. This PR migrates towards Firestore and the recommended loading methods for the Firebase 5.6.0 libraries. Note: the Firebase and Firebase-Admin dependencies should be updated to 5.6.0 and 6.3.0 respectively.
- The with-firebase-auth example won't run unless a database with proper rules is created first.
- Add a small error callback to addDbListener to help with debugging if someone's database connection doesn't work.
* Examples: clarify language around Yarn create & npx
* add missing READMEs and create-next-app usage
* suggest people tag jthegedus in firebase related issues
* add yarn alt instructions
* cerebraljs example readme & fixes
* remove global npm install of create-next-app
* add npx to create-next-app command in examples
* add bash to shell snippets
* add yarn create to next-app command in examples
* fix READMEs named with lowercase
* change READMEs to use UPPERCASE
getToken is now deprecated, you'll get the following message if using the previous code:
firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead.