Angular 15 Authentication (Registration + Login + Role based access) using JSON server REST API

Поділитися
Вставка
  • Опубліковано 2 січ 2025

КОМЕНТАРІ • 190

  • @inesriahi2144
    @inesriahi2144 Рік тому +2

    I wanted to express my gratitude for this excellent video you've provided. Thank you for sharing such valuable content.

  • @Humifystore
    @Humifystore Рік тому +2

    Thanks a lot for uploading using Json-server API 😄

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

    13:33 ---- Error: Can't resolve 'node_modules/ngz-toastr/toastr.css' in 'D:\angular\first'

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

      Did you installed toaster package

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

      @@NihiraTechiees yes resolved

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

      @@NihiraTechiees 31:33 my form is not submitting.
      sumbit button is not working and getting data in db.json as well.. can't see registered successful message

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

      Same submit button isn't working

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

    At 30:17 when i am clicking on submit then neither it is submitting and nor it is navigating to login . I have all previous steps , they all the correct. How can i solve this?

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

      Could you confirm whether register data stored in json file

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

      @@NihiraTechiees no it is not storing in json

  • @antoniocpjunior
    @antoniocpjunior Рік тому +4

    Thanks so much Bro! It's just what i need to start my project !!

  • @anmasa
    @anmasa Рік тому +2

    Me ha parecido un tutorial muy bueno y muy completo, darte las gracias por tu tiempo, saludos desde España.

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

    Thanks bro . I followed your tutorial It helps me well

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

    Thanks, Mate! Amazing tutorial!

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

    Many thanks for this tutorial, very helpfully !

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

    Great video to get start with Angular. I'm from React/Nextjs I'm thinking of learning angular as well. my overall impression is that the learning curve seems no too stip, Please can you advise me other tutorial on how to work with, dynamic routing, internationalisation routing, redux(observable) thank you in advance.

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

      Follow below video you will get most of the topic in angular
      ua-cam.com/video/rZCQiMdQsxE/v-deo.html
      NGRX (same as REDUX) playlist
      ua-cam.com/play/PLfyWdpsiUiPC7bHmDDDM6gGgfo3mgMCAC.html

  • @Abdul-AzeezAhmed
    @Abdul-AzeezAhmed Рік тому

    I tried to use Angular material in a diffrent project to pop up a dialog component but it did not pop up at the center it was showing beneath the entire content of the component that trigers the pop up dialog and i followed the same steps like you did in this tutorial

  • @dattatreyakulkarni541
    @dattatreyakulkarni541 11 місяців тому

    Your video is so helpful and I have one que, join option is there right, why it is , is there any tutorial videos available?

    • @NihiraTechiees
      @NihiraTechiees  11 місяців тому

      Join option? Can you share the time stamp I used

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

    Thank you so much for your sharing knowledge it is helpful in my interview as well

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

    Thanks for the video. But not getting through authentication. while submitting the login form, getting "An error occurred during registration."

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

      What error you received?

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

      @@NihiraTechiees CanActivate is deprecate in latest version, so can you please update the solution, thanks in advance.

  • @sunnygupta4201
    @sunnygupta4201 11 місяців тому

    is there any video on duplicate email validation. like when yours is entering duplicate email then it will verify from db and give alter that this email is already exist

    • @NihiraTechiees
      @NihiraTechiees  11 місяців тому

      ua-cam.com/video/jrp1djz0H6E/v-deo.html

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

    informative tutorial thank you for shearing it

  • @weixiangng8279
    @weixiangng8279 9 місяців тому

    Thanks for this tutorial. Can you also implement Auth Guard for the login part?

    • @NihiraTechiees
      @NihiraTechiees  9 місяців тому

      Sure will add in the upcoming videos

  • @shreeyapatil2308
    @shreeyapatil2308 11 місяців тому

    In my code, when I use auth guard in that file, it shows 'canactivate' is deprecated.

    • @NihiraTechiees
      @NihiraTechiees  11 місяців тому

      ua-cam.com/video/1FgSlvsywXg/v-deo.html

  • @愛-i7y8j
    @愛-i7y8j Рік тому

    thank you, you have helped me a lot, greetings from Bolivia...

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

    Its a wonderful video thanks for the effort. Only one request from my side is do the authentication and authorization using jwt.

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

      Jwt video already I have done. Can you check my angular authentication playlist

  • @sangamithrapc6141
    @sangamithrapc6141 9 місяців тому

    Sir "json-server --watch db.json" when i enter this command its shows not recognised. Should I install json first??

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

    Hi, I have followed your tutorial. Till the updatepopupcompoentn its working fine, but while updating the isactive checkbox auto check is not working, and also unable to update also, its throwing 404 error on clicking update button could you please tell me where i may went wrong?

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

      Ok let me check will update you by tonight

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

      @@NihiraTechiees Hi , did you got the issue?

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

    If possible please make a detail video on 'how to write test cases' like this video please......

  • @connectingdots0-0
    @connectingdots0-0 Рік тому

    Hi, What would be the role name to add Customer detail? I am getting error "you are not authorized to access."

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

      Follow the video hope you will get the information.

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

    This tutorial was amazing! Helped me out a lot with my personal project. However there's just one thing I can't seen to get right .The username is being attached to the apiURL and i'm getting a 404 not found. How can I fix this? I would like for when the user logs in and submits the form for the url capture the ID as this is how my routes are set up. {path: 'cat/:id', component: CatUserProfilePageComponent},

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

      Can you share what url you provided and your route values.
      Better share details to my email

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

    Do you have any idea why the login screen does not respond correctly to reducing the size of the browser? When decreasing the horizontal width, the right side gets cut off. The left side does fine. I have tried all kinds of FlexBox directives (which seem to work) but I can't get the cards to shrink monotonically. The right side always gets cut off.

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

      Will check, design point of view I am also not familier

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

      @@NihiraTechiees Regardless, this a great video! I have learned a boatload.👍👍👍

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

    Hi tankyou it is really usefull, but i have a mistake, the inputs form are aligned one after the other, i dont know if you gave some class to this?

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

      Actually I am not added class. I just did in the dynamic manner (based on Formcontrol data formated)

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

    hello can you make a video for radio button and text area display in console without button .use only click radio button. like 1st radio button is yes and the same line text area. but only one click for both. thank you

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

    am submitting the registration details its not storing them in the db
    why?

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

      Can you debug, where it's lost the data. Also check if any issues

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

    canActivate is deprecated .. how to solve this?

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

      What is your angular version?

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

      @@NihiraTechiees Angular CLI: 15.2.7
      Node: 18.16.0
      Package Manager: npm 9.5.1

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

      Sorry for the late reply from angular 15.2 canActivate deprecated so we have to use CanActivateFn follow the below code
      export const auto1Guard: CanActivateFn = (route, state) => {
      return true;
      };

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

    Muchas gracias Mister Nihira por compartir conocimiento....

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

    Users can overwrite key values at session storage. How can can you protect against it?

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

      If security is the concern we can encrypt and store

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

    HI, I have folowed your tutorial, after creating complete registration, when clicked on submit, its going to else part, showing please enter valid data,
    please help me with this code.

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

      Can you share the data you passed and reactive form declaration

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

      @@NihiraTechiees
      export class RegisterComponent implements OnInit {
      constructor(private _formBuilder: FormBuilder, private _toastr: ToastrService,
      private _authService: AuthService, private router: Router) { }
      ngOnInit(): void {
      }
      registrationForm = this._formBuilder.group({
      id: this._formBuilder.control('', Validators.compose([Validators.required, Validators.minLength(5)])),
      name: this._formBuilder.control('', Validators.required),
      password: this._formBuilder.control('', Validators.compose([Validators.required, Validators.pattern('(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.
      ])(?=.*[A-Z])(?=.*[a-z]).*$"')])),
      email: this._formBuilder.control('', Validators.compose([Validators.required, Validators.email])),
      gender: this._formBuilder.control('male'),
      role: this._formBuilder.control(''),
      isActive: this._formBuilder.control(false),
      })
      proceedRegistraion(){
      if(this.registrationForm.valid){
      this._authService.proceedRegister(this.registrationForm.value).subscribe(data=>{
      console.log("success")
      this._toastr.success('Please contact admin for enable access','registered successfully');
      this.router.navigate(['login'])
      })
      }
      else{
      console.log("failure")
      this._toastr.warning("Please enter valid data")
      }
      }
      }
      form:

      username



      Name



      Password



      Email




      Male
      Female



      Submit
      Back to Login

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

      @@NihiraTechiees I think problem is with the password field. after entering proper password the field still looks red color.

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

      I hope we used pattern validation for password so time being remove pattern validation. I will verify pattern validation if any findings share with you.
      If possible try to join the membership

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

      @@NihiraTechiees yes its working, i removed password validation, but why the problem with validation?

  • @karthick.b5071
    @karthick.b5071 Рік тому

    Hi bro, I tried your guidelines, but stuck in datasource in mattable is not working

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

      Chek material ui version in package.json and confirm have you imported mattablemodule

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

    I do not understand regex at all, but I think you said at least 8 characters and at least one upper case, lower case, number, and special character. But if I start my password with a number the validator regex fails. If I don't start with a number, I can create a password that passes. What can I do to allow a password to start with a number?

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

      Honestly I am also not good making regax. I just used pattern that i got from google search.
      In your case just browse you can generate regax through online based on the requirements. Else watch some regax basics video

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

    Authgaurd not. Working sir, class constructor authgaurd cannot be invoked without new

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

      ua-cam.com/video/1FgSlvsywXg/v-deo.html follow this video

  • @funcoding1797
    @funcoding1797 8 місяців тому

    excellent, thanks😊👏👏👏

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

    I am getting the error for the ' localhost:3000'. Err_connection_refused

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

      May the the port number already in use so try with other port number ex. 8000

  • @Jet-jet-xb8hy
    @Jet-jet-xb8hy Рік тому

    Good tutorial, but you forgot to add error catcher in the log in. What if the user didn't register and tried enter credentials that is not yet created or registered.
    thank you

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

      I got your point, but when I was planning this video it's just basic crud video. then just changed into basic registration. Upcoming videos will consider all real time facts

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

    Great content, Thank you👊

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

    Will it work using Angular16 actually data is not adding after clicking submit btn

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

      It will work. Can check step by step you missing data?

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

    hello sir i dont know why but i have a problem while executing this command ng c register (Error: This command is not available when running the Angular CLI outside a workspace.) just in this project but in other anglar project its working .please some help .

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

    Bro, Why we are using FormBuilder instead of FormGroup and FormControl. Is there any advantages?

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

      Form builder is abstract of form group, control, array. Instead of creating new object of all items we can use form builder instance

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

    A very useful tutorial

  • @Mst.EshitaKhatun-y7u
    @Mst.EshitaKhatun-y7u Рік тому

    I follow your code but user registration form (submit) is not taking any value. Why it is so Answer please

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

      Is your screen refreshed after you submit?

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

      @@NihiraTechiees yes brother. Now it works

    • @Mst.EshitaKhatun-y7u
      @Mst.EshitaKhatun-y7u Рік тому

      If I do not run in json server in the browser at that time input value (registration/ login) is not submitting. why it is so?? If I run json server in the browser at that time it works fine. please let me know the actual issue for this.

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

      It's dummy api also need to be running mode. Just running -- watch command is fine not required to open url in browser

    • @Mst.EshitaKhatun-y7u
      @Mst.EshitaKhatun-y7u Рік тому

      @@NihiraTechiees One more queries: Toastr is not working properly. it just only shows the messages in left bottom position but not any block box with color. Currently I am using angular cli 15.2.3 and ngx-toastr 16.1.0 Additionally I followed all the set up for displaying toastr but its not working properly. Please let me know why it is so?

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

    if you add user password in json server , any one can view the data in jason server , so is this safe ?

    • @NihiraTechiees
      @NihiraTechiees  Рік тому +2

      Json server is kind of fake api (only used for study or development). Real-time you have to use separate api

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

      @@NihiraTechiees oh okay, so I have to use something like MySQL and all

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

      You need to hash the password

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

      @@superuser8636 bro, yeah I thought about it, we need a whole server running in another port and angular running in separate port , the whole db logic must run in server .. but this is very cumbersome

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

      @@new_contents_all_day Welcome to full-stack programming where that's standard practice.. You can use the bcrypt library for hashing your passwords

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

    Hi bro , can you make video on authorization in lambada in aws gateway with angular integration

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

    Hi bro , can you make video on authorization in CASL with angular integration?

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

    Would be better if you can create a video for interceptor as well with complete authentication and authorization

  • @VijayKumar-fq4ie
    @VijayKumar-fq4ie Рік тому

    Good Tutorial 👍🏻

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

    Good tutorial bro.. It would be very helpful if you can make a tutorial on how to preview and confirm form data before submitting it to the server in angular. Thank you for this tutorial

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

      Noted your suggestions, will include future video

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

    Amazing sir

  • @christopher.r0104
    @christopher.r0104 Рік тому

    how to i add menu in json array in this project

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

      You can keep in array. Based on the data we can generate menu dynamically

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

    Great tutorial. thanks

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

    sessionStorage geting null vale? pls help sir

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

      Did you set the value in session

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

      @@NihiraTechiees
      Thanks for your reply sir,
      I am new to angular, I just follow your steps. How to set the value in session?

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

      Ok can you share the files to my mail. I will check and let you know by tmrw

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

      @@NihiraTechiees
      Sorry sir, I re-watched full video, i missed the portion where the setItem.
      Thanks for your valuable time..

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

    Very nice ❤❤❤

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

    Ottimo tutorial. Grazie

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

    Great! Thank you!

  • @harshavardhanpatekar5697
    @harshavardhanpatekar5697 10 місяців тому

    Json server not starting. Please help!!

  • @noraitafti74
    @noraitafti74 11 місяців тому

    toast notifications are not working for me :(

    • @NihiraTechiees
      @NihiraTechiees  11 місяців тому

      Have you followed all steps?

    • @noraitafti74
      @noraitafti74 11 місяців тому

      @@NihiraTechiees I had to add some lines in app.config and now is working

  • @DINESHKUMARC-sp4lq
    @DINESHKUMARC-sp4lq Рік тому +2

    sir pls upload all type of videos in tamil tamil la English's videos irrugu but tamil la videos illa pls consider this one and pls upload tamil

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

      Don't have enough time bro, will consider your request soon

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

    can i contact with you by phone for some problem about Angular!! please

  • @durga.k.b.durga.kb.8941
    @durga.k.b.durga.kb.8941 8 місяців тому

    How to add the jaon server in vs code

    • @NihiraTechiees
      @NihiraTechiees  8 місяців тому

      Install the json server via npm command

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

    Nice!

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

    First comment

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

    where i can get BE api source code

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

      This video I used json- server api(fake api) it's just json file

  • @serignecheikhahmettidianes7085

    Very good work.
    Can I have your Backend code of angular application.

  • @HtooA-h2i
    @HtooA-h2i Рік тому

    Thanks.

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

    first which password use

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

    PUT /user/[object℅20Object] 404

  • @hugosilva-kg6vr
    @hugosilva-kg6vr Рік тому

    Show

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

    please give me source code sir

  • @atozupdates-telugu3120
    @atozupdates-telugu3120 Рік тому

    sir, can't install ngx-toastr it does not install it shows an error, icant understand . what can i do please clarify my doubt
    here is my issue :
    D:\sai-angular-practice\veeru_workspace>npm install ngx-toastr -save
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: veeru-workspace@0.0.0
    npm ERR! Found: @angular/common@15.2.10
    npm ERR! node_modules/@angular/common
    npm ERR! @angular/common@"^15.2.0" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer @angular/common@">=16.0.0-0" from ngx-toastr@17.0.2
    npm ERR! node_modules/ngx-toastr
    npm ERR! ngx-toastr@"*" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR!
    npm ERR!
    npm ERR! For a full report see:
    npm ERR! C:\Users\91961\AppData\Local
    pm-cache\_logs\2023-10-18T16_54_38_869Z-eresolve-report.txt
    npm ERR! A complete log of this run can be found in:
    npm ERR! C:\Users\91961\AppData\Local
    pm-cache\_logs\2023-10-18T16_54_38_869Z-debug-0.log
    idont understand my problem , please solve this

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

      While install use the specific version.... Look like version conflict

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

    how to change the login form, so i can login with the name, not the id?

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

      Create model class before sending to api comvert form value into this model format

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

      @@NihiraTechiees ok ty, what should i do when i want to insert the users data into a postgresql/any sql database when a registration is made?

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

    Firstly thank you very much for the great tutorial, I seem to have an issue on the below code while trying to login, "this.userdata" is undefined but I do have the data from the db.json file futhermore when debugging I can see the username value going to the service. Please help!!
    if (this.loginform.valid) {
    this.service.Getbycode(this.loginform.value.username).subscribe(res => {
    this.userdata = res;
    console.log(this.userdata);

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

      Can you confirm your API returning data? If yes what value you getting console.log(this.userdata).

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

    SIR I WRITE SAME CODE BUT MY USER DOESNOT UPDATE it give error For url ?
    Why can you explain plzzz

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

      Put console.log and find where it's breaking

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

      console Is working When A establish Role Then giving this error

  • @durga.k.b.durga.kb.8941
    @durga.k.b.durga.kb.8941 8 місяців тому

    My error is not recognized for internal external command how to add

    • @NihiraTechiees
      @NihiraTechiees  8 місяців тому

      Could you share more details to my email