Firebase Google SignIn + Firestore w/ Angular

Поділитися
Вставка
  • Опубліковано 10 січ 2019
  • Learn how to build a solid user authentication system in Angular with Firebase Google SignIn, then create custom data in Firestore. Source code and article 👉 fireship.io/lessons/angularfi...
    Original Lesson: angularfirebase.com/lessons/g...
    Firebase: firebase.google.com/
    Angular: angular.io/
    ngx-firebase-ui: www.npmjs.com/package/ngx-aut...
  • Наука та технологія

КОМЕНТАРІ • 185

  • @joshkramer262
    @joshkramer262 2 роки тому +16

    Would be great to have an update, as it seems like AngularFire has completely changed names of objects since this video was published.

    • @kristianivanov8254
      @kristianivanov8254 Рік тому

      Form what I found is that the imports from '@angular/fire/firestore' presented in this demo are now in '@angular/fire/compat/firestore'. I am using @angular/cli 15.0.2 and @angular/fire 7.5.0

    • @ransfordarthur4418
      @ransfordarthur4418 Рік тому

      Unfortunately, Jeff/Fireship doesn't seem too keen on Angular lately,
      so I highly doubt a follow-up video will come
      fingers crossed though

    • @kaibe5241
      @kaibe5241 Рік тому

      @@ransfordarthur4418 na he’s still in love with it. He’s just playing with new tools of late, as that’s what people want to see.

    • @idontcreatecontent741
      @idontcreatecontent741 Рік тому +1

      @@ransfordarthur4418 His tutorials/content will be whatever the hip new thing is so he can attract more customers. Unfortunately Angular doesn't do that, even if it is still a widely used language. It's crazy how much React content there is relative to Angular.

  • @jamisonr
    @jamisonr 5 років тому +131

    I've watched a lot of videos from this channel, and while they are well produced, there is something about the presentation that I find hard to follow. I'm not sure if it's just too fast, or if I want more background information, or something else (or all of the above).

    • @shakarshahedan
      @shakarshahedan 4 роки тому +2

      Me too :(

    • @zeyadahmad4556
      @zeyadahmad4556 4 роки тому +5

      YES!! I would pretty much love more background information. I need to know how we came up with this code and why does there lines work.

    • @brianwells990
      @brianwells990 4 роки тому

      For what it's worth, I loved this video and felt it was done very well. That said, I've spent several years getting up to speed on the underlying topics, and I've still got a long ways to go.

    • @randallerasmus
      @randallerasmus 4 роки тому

      @Useful Code Recipes You need to register and watch the whole course and pay for it. Money making ..........

    • @peterveliki7918
      @peterveliki7918 4 роки тому +4

      I was very frustrated too, especially at the beginning ... but with more time passing by I realized that these videos are not tutorials actually ... they are mixture between showing off and providing just a glimpse of what you can do with Angular. ... So now I watch them a lot, but with different mindset: if now I like a topic - I know I can use the video, but I'll need to research a lot of stuff aside from this ... :) ... and these videos are just a piece of the puzzle, not the whole one.
      (Which probably is the actual goal of @fireship :) ...)

  • @oscar272731
    @oscar272731 5 років тому +1

    I really loved the part about firestore rules, I needed that kind of tip. Awesome video.

  • @Bill_Ahern
    @Bill_Ahern 5 років тому

    Thanks for this. Incredibly timely as I am implementing this exact thing over the weekend.

  • @davebeazer4007
    @davebeazer4007 4 роки тому

    Excellent video. So clear and concise - thanks Jeff!

  • @wes443
    @wes443 5 років тому +3

    A video on Angular libraries would be cool. Explain why/when to create a library and then how to create it and how to use it in a main project. Also, maybe a video on general guidelines for the structure of an angular project. Where to put services and models, when to make something a module, etc.

  • @NoorUddinWD
    @NoorUddinWD 5 років тому +1

    Looking forward to more Angular and Firebase videos!

  • @cezarkhaloul1289
    @cezarkhaloul1289 Рік тому

    You got a great implementation Mate !!🔥🔥🔥

  • @yavomax
    @yavomax 2 роки тому

    Great! Thank a lot for so useful and short tutorial. It has closed some my critical question about this topic

  • @mahmoud-kassem
    @mahmoud-kassem 5 років тому +1

    Thanks for the great tutorial.
    It through a permission error after applying the database rules, it were fixed after adding, read permission to allow users rule, but I'm not sure if this is secure or not.

  • @alanhernandez4989
    @alanhernandez4989 4 роки тому

    Gracias,nde verdad. Recién estoy comenzando en web con angular y firestore, y este vídeo me ayudo bastante.

  • @tiedye001
    @tiedye001 5 років тому

    Would this be difference if you were using a state library like ngrx? Or would authentication be outside of its scope

  • @TerVentures
    @TerVentures 4 роки тому

    How do I allow only few specific people? Please help. Thanks! I was troubled by the tilde key but now this is my only problem left. I want to authorize few more people

  • @alexsky7694
    @alexsky7694 4 роки тому

    Great structure. Thank you! Saved me a lot of time.

  • @slasladuplo4
    @slasladuplo4 5 років тому

    Can I use the email login with ionic instead of only angular with the google signin? Also, I dont get how to utilize the http requests to set up backend, it would be awesome to have an crud/auth with cloud functions.

  • @kastoras1995
    @kastoras1995 5 років тому

    Thanks for the tutorials,i would like to ask you a question.Lets say a user register in my app when he is offline ,how can i store the data locally and when he is offline sync them to firebase.The logicis quite simple but making it work is what concerns me.Thanks in advanced.

  • @elmotareal
    @elmotareal 5 років тому

    at the end of the video there was a reference to request.auth.uid, im just wondering how did that pass?

  • @blado9059
    @blado9059 4 роки тому

    that was really helpful jeff, but how could I do it with roles like admin for example?

  • @holytrashbag7300
    @holytrashbag7300 2 роки тому

    Very nice summary, even 3 years later!

  • @cupidchan1763
    @cupidchan1763 4 роки тому

    I like this video as it covers an important Firebase and Angular concept in authentication. But if I have a node server as my backend, how can this come along in the equation? Shall I set the same authentication in node and direct the traffic from Angular to node? How can the session maintained and passed between frontend Angular and backend Node?

  • @abinthomas12914
    @abinthomas12914 4 роки тому

    Whether we can do firebase Google authentication in angular electron build (specifically when it run in local host)

  • @sabufer
    @sabufer 4 роки тому

    Great content, thanks, Jeff!

  • @bustamantedev
    @bustamantedev 5 років тому

    why are we making the user$ observable equal to afAuth.authState instead of afAuth.user , what is the difference? thanks in advance

  • @hbkstudio9085
    @hbkstudio9085 5 років тому

    Is this tutorial in complete or from where that login with google button came from under BASE

  • @jothishjj6624
    @jothishjj6624 Рік тому +1

    Amazing tutorial!

  • @kudrashabani6426
    @kudrashabani6426 4 роки тому

    Thank you, this will be for all platforms ? like : android and iOS....

  • @JFkingW
    @JFkingW 5 років тому +1

    I would love to see more about SEO and Angular

  • @carniattos
    @carniattos 5 років тому

    Awesome! A good chapter to revisit might be the file upload and add some tips how to deal with EXIF orientation

  • @DecodedFrontend
    @DecodedFrontend 4 роки тому +1

    Nice tutorial! I personally find Angular + Firebase as one of the most efficient stack for prototyping!

    • @crkell3548
      @crkell3548 4 роки тому

      hi is this tutorial still relevant today?

  • @davidkhvedelidze6536
    @davidkhvedelidze6536 2 роки тому

    as always fireship has the best tutorials

  • @adelmerhej4194
    @adelmerhej4194 5 років тому

    Amazing explanation, thanks a lot.

  • @StephenMoreira
    @StephenMoreira 5 років тому +4

    Love it! Angular

  • @viniciusgalvao6270
    @viniciusgalvao6270 4 роки тому

    Great tutorial with your web site! Thanks.

  • @Tiesthatbindus
    @Tiesthatbindus 5 років тому +2

    EXCELLENT! And great context! Fast but that's why there's pause (an hour to walk/code through the 11 minute vid).
    One problem I had is I cannot add additional user parameters. I get a FirebaseError "DocumentReference.set" "invalid data" Unsupported field for anything additional I try to add. Ex. isAdmin?: Boolean. How do I need to put this in?
    Thanks!
    UPDATE: Figured it out - Needed to check for the presence of the property on the user object in updateUserData and if null, assign it before creating the data object. Ex. if (isAdmin == null) isAdmin = false;

  • @obeydadjeffal4442
    @obeydadjeffal4442 5 років тому

    Nice video, seeing the same with flutter would be great

  • @intrinsicangularmomentum5853
    @intrinsicangularmomentum5853 3 роки тому +1

    How can this be done with react. Please make video. I cant figure out how to send user to firestore in react. I only can do login and that is it

  • @TristanGreenidge
    @TristanGreenidge 4 роки тому

    What if I'd like to save users to the realtime database instead?

  • @thatprogrammer7608
    @thatprogrammer7608 3 роки тому

    Does anyone have the code for this project with the latest version of Angular on their GH? My program will compile with no errors, however when I open up local host, nothing is generated.

  • @roflmao0o
    @roflmao0o 5 років тому +1

    My authState change triggers like 6 times everytime i navigate to a new route. Anyone else having this problem? Havn't found any solutions online yet.

  • @JuanPabloVargasRodriguez
    @JuanPabloVargasRodriguez 5 років тому

    Really excited for any flutter videos!

  • @DailyDoozeOfficial
    @DailyDoozeOfficial Рік тому

    Unfortunately does not work with Safari browsers -they block popups and firebase returns: firebase: Error (auth/popup-blocked)

  • @vinektobas3706
    @vinektobas3706 4 роки тому

    THANK YOU, you saved my day with this tutorial

    • @crkell3548
      @crkell3548 4 роки тому

      hi is this tutorial still relevant today?

  • @christiangonzalez5270
    @christiangonzalez5270 4 роки тому

    Great Lesson!

  • @dragos-andreiilies526
    @dragos-andreiilies526 3 роки тому

    I don't understand the rules. How do they know I am referring to the User ID from my app? I don't understand how it checks if I am on the right account.

  • @moosegoose1282
    @moosegoose1282 4 роки тому

    everytime a user logs in it calls the 'set' method to Firestone. doesn't that end up charging us even though nothing is being changed for returning users?

  • @arjunhadke1113
    @arjunhadke1113 2 роки тому

    Really need the Vue and Flutter tutorials.

  • @sveinsoermo9883
    @sveinsoermo9883 5 років тому

    Great as always, updates on SendGrid and Stripe, will be very much appreciated..:-)

  • @MrAncha3
    @MrAncha3 5 років тому

    Flutter would be really good to start with!!

  • @arronmccrory
    @arronmccrory 5 років тому

    Thanks I hoping you would make this video! Can you make a similar video that explains how to do this in a NativeScript/Angular app?

  • @Dude29
    @Dude29 2 роки тому

    What font is that on your vscode?

  • @joshpetit
    @joshpetit 2 роки тому

    Awesome Video. I see that Jeff created entries for the user's display name and photo URL although this is something that can be handled by the authentication service, does anyone have experience in seeing that having that information in the Firestore being more useful than letting the auth service handle it?
    Edit:
    After 10 seconds of playing around with it, I saw that the benefit is that you can query this information from other users as well. If you were to only use Firebase auth, only the signed in user could view their display name, you need it in firestore to let other users query that information also. Awesome stuff as always :)

  • @marcusgallegos8384
    @marcusgallegos8384 5 років тому

    Has anyone figured out how to make this work for the Facebook provider. I tried following the same model as the google provider setup but it's not working. Ideas? Also anyone got good resources for understanding the angularfire library? The docs aren't very clear...
    async facebookSignin() {
    const provider = new auth.FacebookAuthProvider();
    const credential = await this.afAuth.auth.signInWithPopup(provider);
    return this.updateUserData(credential.user);
    }

  • @user-xx5kx8mv5r
    @user-xx5kx8mv5r 7 місяців тому

    a similar video for Kotlin Jetpack Compose would be a great help

  • @TrendSpotlightWithAbhishek
    @TrendSpotlightWithAbhishek 5 років тому

    Awesome video... thanks a lot.

  • @slasladuplo4
    @slasladuplo4 5 років тому

    ObjectUnsubscribedErrorImpl {message: "object unsubscribed", name: "ObjectUnsubscribedError"} -- When I log in and logout, then log in again, this error pops up in the console, how to fix that? Is it dangerous?

  • @patrickmullot73
    @patrickmullot73 5 років тому +4

    Good refresh, thanks!
    Authentication and permissioning are really complex parts of any app. Firebase ecosystem facilitates a little the first approach but is really far from doing an enterprise-grade auth system. It would be really cool to have a video about more advanced features like how to handle user administration, how to set up roles and permissions securely, etc..

    • @Fireship
      @Fireship  5 років тому +2

      Yes, that is a topic I will revisit soon. I tackled role based auth awhile ago, so maybe next time I will setup an access control list

  • @techstacker5361
    @techstacker5361 5 років тому +2

    Damn, Firebase looks so slick. Would love to see how to do this with React. Great video! 👍

  • @davidbeljan
    @davidbeljan 5 років тому

    Love your work! 1 vote for Flutter

  • @rudolfklikh5779
    @rudolfklikh5779 5 років тому

    Best video about Firebase + Angular.Like

  • @duncan-dean
    @duncan-dean 5 років тому

    Maybe some unit testing in Angular for services using @angular/firebase? This seems to get tricky with some observables and Firebase specific things.

  • @DheerajRijhwani
    @DheerajRijhwani 5 років тому

    Please make more videos on basics
    .

  • @themindstorm9947
    @themindstorm9947 5 років тому

    How do I use async variables in typescript?
    constructor(public auth: AuthService) {
    console.log(auth.user)
    }
    returns something else

    • @Fireship
      @Fireship  5 років тому

      You need to subscribe to the observable, then provide a callback, like this: auth.user.subscribe(console.log)

  • @samopper
    @samopper 4 роки тому

    I had a typo in the template html saying this.users$ instead of this.user$ and it took me so long to figure out why nothing was happening when i logged in :(

  • @anymeshsingh
    @anymeshsingh 5 років тому +32

    Looking forward to Flutter related content on this channel.

    • @Fireship
      @Fireship  5 років тому +7

      The plan is to release the first flutter vid this month.

    • @basdfgwe
      @basdfgwe 5 років тому

      Yesssssss!!!

    • @Hastalavista1020
      @Hastalavista1020 5 років тому

      Please Flutter more...

    • @divinedela9125
      @divinedela9125 5 років тому +1

      @@Fireship yassss

  • @GengisCetina
    @GengisCetina 5 років тому

    I'll like too see the Flutter implementation

  • @SouravDuttaROCKSTAR
    @SouravDuttaROCKSTAR 5 років тому +1

    So that's how our fireship.io works .. already signed in to stay up to date and I'm going to do the same with my own website
    Exactly what I wanted for my blog ! This video is lit 🔥👌❤️

    • @Fireship
      @Fireship  5 років тому

      Thanks! That's why I updated the original - it's a super important topic.

    • @SouravDuttaROCKSTAR
      @SouravDuttaROCKSTAR 5 років тому

      Thank you so much waiting for more super cool videos 😎🤘

  • @jeromestsauver
    @jeromestsauver 5 років тому

    would love to see this same tutorial with flutter

  • @tommywebermikkelsen3491
    @tommywebermikkelsen3491 5 років тому +7

    A Flutter version would be awesome!

  • @yuhabkat
    @yuhabkat 5 років тому +6

    thanks Jeff, what about sign in with email/password..

    • @AverageMrFox
      @AverageMrFox 5 років тому +1

      There's a method called signInWithEmailAndPassword which you can use if you just pass the email and password in as parameters. You'll need to get the email and password from a form or some other means naturally, but other than that it's straightforward enough.

  • @giacomodelillo1719
    @giacomodelillo1719 3 роки тому

    can you do it whit js please?

  • @junaid.hassan
    @junaid.hassan 5 років тому

    Stripes connect, real-time maps ionic, flutter and also native script :D

  • @DeimosBricks
    @DeimosBricks 5 років тому

    Another useful solution to use with Firebase Auth is a BehaviorSubject. That way you can access to your current user info by dot notation and not subscribing.

  • @shivamummoju4820
    @shivamummoju4820 5 років тому +5

    Would appreciate if you show the same process with react! Excellent work with angular though.. very clear and concise. Would be better if you could link through the documentation of various packages and libraries you have used. Thanks!

    • @Fireship
      @Fireship  5 років тому

      Thanks for the feedback. They are linked in the main lesson page, it's time consuming to duplicate everything on YT.

  • @kencale
    @kencale 3 роки тому

    Please make the flutter version of firebase auth stream listening. Very expecting. Thank you.

  • @qwiiky
    @qwiiky 5 років тому +1

    Awesome, I like how Jeff has to wrap things up because baba aka "Boss Baby" in the background is hungry..Lol. I think baba is calling out Daddy to console.log(' pls put my crying emoji in the first video') for fireship.io. Great first video for fireship.io and 2019. Awesome job.

    • @Fireship
      @Fireship  5 років тому

      Haha! You have no idea how many clips I have to re-record due to crying babies. If you listen closely you should hear one in every video.

  • @erickbrenessolano6311
    @erickbrenessolano6311 4 роки тому

    This implementation executes constant requests to firebase. is there any wait to avoid this?

    • @wayne_gakuo
      @wayne_gakuo 3 роки тому

      You could also add NgRx for state management and it would handle this for you by storing up the info you're requesting from Firebase

  • @peterveliki7918
    @peterveliki7918 4 роки тому

    How come you import auth from firebase/app - and it's working ?? .. It should be `import { auth } from 'firebase'` only ... :D

  • @joe0hill
    @joe0hill 5 років тому +2

    How would you approach unique usernames? Maybe a video on this next?

    • @Fireship
      @Fireship  5 років тому +4

      Added that to the revisions list +1

  • @RuwanAtapattu
    @RuwanAtapattu 4 роки тому

    Thank You.. !

  • @samheyman09
    @samheyman09 4 роки тому

    Looking forward to a React version! These videos are amazing, thanks 👍

  • @amodh
    @amodh 5 років тому +8

    Create one with vue please

  • @divinedela9125
    @divinedela9125 5 років тому

    Thanks JEff. I would like to see how you would do this in reactjs

  • @maiconm
    @maiconm 5 років тому

    should the user.model.ts be user.interface.ts?

    • @Fireship
      @Fireship  5 років тому

      It's up to you. I prefer model, but it doesn't matter.

    • @Bill_Ahern
      @Bill_Ahern 5 років тому

      it IS up to you, but that's not the convention. The Interface is your model type, as you could just as easily use a Class to define your model, but they would both still be models (ie, the shape of your data object).

  • @Flipkurama
    @Flipkurama 5 років тому

    I think these rules aren't correct. I did the same thing and I get an error!

  • @JAOC-ey3eo
    @JAOC-ey3eo 2 роки тому

    thanks

  • @saisreenivas2227
    @saisreenivas2227 5 років тому +1

    Thank you

    • @Fireship
      @Fireship  5 років тому +1

      Thanks for watching

  • @marcusgallegos8384
    @marcusgallegos8384 5 років тому

    Do this with Vue! FireVue all the things!

  • @JancoBH
    @JancoBH 5 років тому +1

    We will have an Angular Universal + Firebase Cloud Functions video?

    • @Fireship
      @Fireship  5 років тому +3

      Yes, that is a topic on the list.

    • @JancoBH
      @JancoBH 5 років тому

      @@Fireship 😍😍😍😍

  • @ArifWaqasofficial
    @ArifWaqasofficial 5 років тому +2

    Thanks for the awesome know about of how auths work, would be glad if you could re do it with React.js in the future ^_^

  • @CahoneyXD
    @CahoneyXD 5 років тому

    Has anyone got this to work using ionic ?

    • @Fireship
      @Fireship  5 років тому

      This will only work in Ionic for the web. Native platforms will need to use the google sign in cordova plugin.

  • @hiteshchoudhary3412
    @hiteshchoudhary3412 5 років тому +5

    When flutter course is coming to fireship????? Please

    • @Fireship
      @Fireship  5 років тому +3

      I don't have a timeline for a full course, but you can expect the first flutter video sometime this month :)

    • @hiteshchoudhary3412
      @hiteshchoudhary3412 5 років тому

      This is not going to be full course???

    • @Fireship
      @Fireship  5 років тому +1

      @@hiteshchoudhary3412 It depends on what you mean by full course... On Fireship, a full course is ~20 videos, but I also create standalone episodes like this one here.

    • @hiteshchoudhary3412
      @hiteshchoudhary3412 5 років тому

      @@Fireship ok

  • @christopherkiessling
    @christopherkiessling 5 років тому

    hey man, we want to learn Flutter from you 😀

  • @himesh_89
    @himesh_89 5 років тому

    use case of web application and its architect on firebase, complexity level - Medium

  • @Trevor.Morrice
    @Trevor.Morrice 3 роки тому +1

    broken with new angular :(

  • @collinslagat3458
    @collinslagat3458 5 років тому

    Do one with Vue.

  • @MrOnizukakira
    @MrOnizukakira 5 років тому +4

    Pleaaase make a react version of the video .. thank you

  • @manojisaac
    @manojisaac 4 роки тому

    match /{document=**} {
    allow read, write : if false;
    }
    match /users/{userId} {
    allow read, write : if request.auth.uid == userId;
    }
    Add read also if the userId matches

  • @BNakato
    @BNakato 5 років тому

    Flutter would be helpful.

  • @TheRomane71193
    @TheRomane71193 5 років тому +1

    React video would be awesome

  • @mattiaesposito5525
    @mattiaesposito5525 5 років тому +13

    please re do the video of PWA

    • @Fireship
      @Fireship  5 років тому +8

      That could be cool, I use workbox to make Fireship.io a PWA. It's actually very easy.

    • @niclasj2871
      @niclasj2871 5 років тому

      @@Fireship Another interesting topic is Persistent authentication for ssr websites via service worker instead of cookies, you can find it in the docs of firebase

    • @themindstorm9947
      @themindstorm9947 5 років тому +1

      @@Fireship is workbox better than angular/pwa?