To prevent a home page to flash just use 'return router.push("...")' instead of 'router.push("...")'. Thus you won't see the home page if you're not signed in. Also can use 'loading' variable coming second from useAuthState hook to render some fallback component. So there won't be any need of adding session storage item.
@Rawailsakib8 ай бұрын
Rayan your best is that you always reply to your learners without hurting them this is your best then your skills
@coderyan8 ай бұрын
Thank you!
@Rawailsakib8 ай бұрын
@@coderyan your welcome man!
@RheddrianBenekander9 ай бұрын
Thanks for sharing this guide! You made a comment about making errors toward the end of the video. I just came here to say that I was looking for this video, and there were a few available... but the other ones I looked at were guys that jump-cut through their mistakes, and they'd copy and paste all of their code so you wouldn't see them typing. Those videos are awful to follow along with. Yours is relatable. Keep doing it the way you're doing it! We're here because we're making mistakes too.
@coderyan9 ай бұрын
Thank you for the kind words, very much so appreciated!
@PáseDigitalАй бұрын
Thank you for the video, App Router and Firebase was a headache until now
@coderyanАй бұрын
Happy it helped!
@fengtaka4 ай бұрын
This is definitely one of the best tutorials I've watched Easy to understand and literally solved an issue I thought would take me hours in such a short time. Thanks!
@coderyan4 ай бұрын
Happy to hear it! Thank you
@MrBlazzerBoy Жыл бұрын
Also please do one for protecting routes: show those pages only if user is logged in.
@ukaszStrzelecki11 ай бұрын
Hi Ryan! Thanks for this tutorial. Can you make full example how to use Firebase Auth also using SSR and proper session storage thru whole application? There is a lot of this kind of tutorials were you can find examples how to signin/login/signout but it ends at this step. Thanks a lot!
@ionutsandu591311 ай бұрын
I successfully managed to do what you're asking for my company but it was quite tricky. This weekend I will create a repo if you'd like so you can get some help from there.
@aro-aro-aro10 ай бұрын
@@ionutsandu5913Hi! Can you please share your repo/GitHub username. I’m learning firebase Auth it would be great if you could share it. Thanks
@MikeBritton10 ай бұрын
@@ionutsandu5913 Very kind of you, if the offer still stands.
@aro-aro-aro8 ай бұрын
@@ionutsandu5913can you share the repo url? Thanks in advance
@emokiniovoaghogho74204 ай бұрын
@@ionutsandu5913hey, pls can you send me the repo link? I'm working on a project that is supposed to use those features and I have no idea how to go about it
@davidlintin10 ай бұрын
27:36 "I'm gunna change this to jsx because I like the Icon better" - also me.
@coderyan10 ай бұрын
Haha glad you can relate
@alexandergeorgesquire2207 ай бұрын
Hey thanks Ryan Just wondering... Why are you using .env for the config files? The docs say the cofnig data is safe to be on the front end?
@yashraj485511 ай бұрын
Awesome guide! Got my thing working in one go. Thanks a lot 😊.
@coderyan11 ай бұрын
Happy to hear it!
@Growingmindsetalha Жыл бұрын
it is not adding the user in the data base
@cohena100Ай бұрын
when creating the app and when i choose Yes on Would you like to use `src/` directory then it doesn't work. any idea why?
@phptempaltedf8 ай бұрын
it's full ClientSide when we use Firebase auth?
@isagive8 ай бұрын
Thank you brother. the userSession solution seems wrong - the useAuthState changes so maybe we need to wrap in a function and wait for it? i dont know but it still kicks out a lot of error after routing. In anycase, thank you for the hard work very helpfull tutorial
@Robert-gr1cl2 ай бұрын
beautiful tutorial, worked perfectly for me!
@coderyan2 ай бұрын
Happy to hear it!
@Growingmindsetalha Жыл бұрын
why is it giving the res undefined?
@Abhishek-f1q7m5 күн бұрын
use the correct gmail and its correct password
@juancabanas2687 ай бұрын
How can I refresh the user idToken after expiration? How is that process? After 1 hour, the user is not retrieved and no refreshed id is gotten. Please, I'm really stuck in that process 🙏. I'm building a PWA with NextJS and I need the user to always be signed in
@proflead4 ай бұрын
Thanks for the tutorial Rayan!
@coderyan4 ай бұрын
You’re welcome!
@gokulnaathb262711 ай бұрын
Thank you so much, Ryan, this will help me.
@coderyan11 ай бұрын
You’re welcome!
@treasuredev28 күн бұрын
Nice, but if you create a nextapi to handle functions from the backend, it logs users out after ah hour. I don't want to call my config from client side. I want to handle everything in next api functions
@Robert-gr1cl2 ай бұрын
if i refresh the page on the home screen it logs me out (i did this exactly the same) why is that?
@lucasrodrigues68010 ай бұрын
Thank you for the guide. It helped me a lot! The only issue that I had was the errors. The react-firebase-hook did not throw some of my errors automatically. I had to get the errors from the hook and then throw it manually. Something like this: const [signInWithEmailAndPassword, user, loading, error] = useSignInWithEmailAndPassword(auth) try { const res = await signInWithEmailAndPassword(data.email, data.password) if(error){ throw new Error(error.message) } reset() router.push('/my-chats') } catch(err) { console.error(err) }
@priyapandey895111 ай бұрын
Can't we directly use the config js file for the storing values of those variables? Why are we using them as env variables? Is it some kind of convention to do so?
@nosrehcorporation11 ай бұрын
Safety, you dont want to expose those values in your regular packages
@priyapandey895111 ай бұрын
@@nosrehcorporation ok thankyou sir
@brookt57258 ай бұрын
Have you tried going to / without signing in it displays the content for a short while which is really bad thing
@coderyan8 ай бұрын
Should have covered this in the video, but can be solved in several ways, one of which is by using some loading state
@brookt57258 ай бұрын
@@coderyan Wouldn't that be redundant to do that on each page
@coderyan8 ай бұрын
Wouldn’t need to do it at each page. You can do it higher up in the application (e.g in the root component)
@tabmax225 ай бұрын
should firebase env vars be added to vercel platform to a prod app as NEXT_PUBLIC_...?
@Imraann05 ай бұрын
Can you not handle the user logged in information with get server side props for the home component
@M7ilan11 ай бұрын
you’re so good can you make a same tutorial but showing user data? or maybe username system?
@darkside00948 ай бұрын
thanks man, i've been following the official docs but kept on getting errors. Is "react-firebase-hooks" library a must in order to use firebase with next js?
@dortcel55502 ай бұрын
i could kiss you right now!!!!! this is the best tutorial for a beginner like me. Love you so much brother!! RESPECT!!
@coderyan2 ай бұрын
Happy it helped!
@dortcel55502 ай бұрын
@@coderyan also... loved your commentary it was hilarious 😂
@МишаАнискин-р6ш11 ай бұрын
Hi! Thank you for this video! How did you use async/await in client component? I have an error when try it
@alikawu71455 ай бұрын
Will this make all the components client components?
@aarondean18729 ай бұрын
How would you move the Auth logic into something like an Auth Context?
@ahmedabdel-aal8404 Жыл бұрын
great video helped me a lot, keep it up
@coderyan Жыл бұрын
Happy it helped you out
@Vlada97my11 ай бұрын
I have a question, how can i sing up users and set their first and last name?
@mitaligupta86358 ай бұрын
I am getting an error of module not found in page.js file for config.js file for auth. But I have already made that file.
@pedromendoza81487 ай бұрын
Is this going to make all the app a client component?
@Fluttydev10 ай бұрын
is this secured to store use in session storage ?
@Minu_Shalom5 ай бұрын
Hi Ryan! Maybe I'm wrong, but as I know NEXT_PUBLIC will be included in the client-side JavaScript bundle, making them accessible to anyone who can inspect the website's source code.
@fluffsenpai10 ай бұрын
The home page still flashes when going to the original URL. if the page was to be protected its not.
@janeeshafernando683010 ай бұрын
Thankyou soo much. Its working 😍🥰
@coderyan10 ай бұрын
Happy to hear it!
@TheJoyBoySSK3 ай бұрын
My problem is that there is no code written in SignIn.js file that checks the databse for users and then signs them in, it just creates a new user in signIn itself, removing the need for signup and leading to multiple entries of same users everytime they login
@andreschavez3929Ай бұрын
Thats wrong because you can only have one user with the same email in firebase auth
@StatsOverStyles6 ай бұрын
that was awesome and so easy to use
@coderyan6 ай бұрын
Happy it helped!
@CptJuke9 ай бұрын
hey man great video! It gives me an error ''sessionStorage is not defined" when i try to deploy. Any idea how to solve it?
@shreyashraj9 ай бұрын
'use client'; add this line in top of your page
@CptJuke9 ай бұрын
@@shreyashraj its already in a client side component :(
@shreyashraj9 ай бұрын
@@CptJuke maybe you forgot to import sessionStorage
@juanpabloarroyochavez73118 ай бұрын
Hello, I have the same problem, could you solve it?
@CptJuke8 ай бұрын
@@juanpabloarroyochavez7311 sadly no 😞
@solorashed11 ай бұрын
I don't get the point, If you make all page use client then why you are using next?
@scor32k11 ай бұрын
ig he did this for tutorial purpose, we can rectify the code.
@ionutsandu591311 ай бұрын
@@scor32k Not really. All firebase hooks need client to run. Having a SSR auth with firebase is quite tricky.
@OsamaEhsan-j6w9 ай бұрын
@@ionutsandu5913 you're right, I don't understand why everyone is making video with NextJS title but just handling the issues same as simple React.
@marioperez618010 ай бұрын
The thing is you are doing it only in client side
@vyxian004 ай бұрын
yes, this is okay only if you're using firebase as database since firebase will handle backend protection via security rules.
@omarhabash835510 күн бұрын
counsel vs console ??
@iancarr39239 ай бұрын
Excellent video as usual. Just one plea from littl ol' England on presentation. Please try to avoid saying "go ahead and" too often. Thanks.
@Route-205 ай бұрын
Thank you.
@jabedalamakash8558 Жыл бұрын
thanks
@coderyan Жыл бұрын
You’re welcome
@Ilovemonkey1236 ай бұрын
I love you
@Viviko9 ай бұрын
… Oh. So I have to use hooks and shit… alright. That makes my life easier. I’m used to calling some API instead of FireBase and then storing JWTs. So this is kinda weird. And I’m used to working in SolidJS or Svelte. So this is weird for me.