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.
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
* [with-firebase-authentication] remove deprecated warning
* [with-firebase-authentication] improve client and server credentials example
* [with-firebase-authentication] fix typo in the docs
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.
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.
* don't fetch messages server-side if user is not found
Currently, the component always fetch everything under '/messages' even if the user is not authenticated on the server side. Update it to not fetch if the user is not found as a better example on handling.
* fix lint error
* Rename Firebase Auth example
* Update gitignore to include npm5 lockfile
* Cloud Function
* Add Next app with two pages to demonstrate navigation
* Add Firebase Hosting and configuration to Host & Deploy
* Fix errors in rename for firebase-auth example
* Recommend pkg managers with caches for better perf
* Update with-firebase-hosting example
Fix code
* Update with-firebase-hosting example
Fix npm scripts and package.json files
* Update with-firebase-hosting example
Update README & install scripts
* Update with-firebase-hosting example
Update example package name
* Update with-firebase-hosting example
Fix to use single-quotes
* Update with-firebase-hosting example
VSCode did not like single-quotes! Sorry
* Fix gitignore file