Building a Basic Ionic 4 Login Flow with Angular Router

  Рет қаралды 84,700

Simon Grimm

Simon Grimm

Күн бұрын

Пікірлер: 134
@galaxies_dev
@galaxies_dev 2 жыл бұрын
Want more? Check out some real Ionic clones here: kzbin.info/aero/PLNFwX8PVq5q5K_ztYB5umsEu9p6SOQQSb Make sure to subscribe for more! kzbin.info_?sub_confirmation=1
@grantw6041
@grantw6041 5 жыл бұрын
This has given me a huge head start on my current project. Thank you for making this material free and easy to access!
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Thank you so much Grant, always happy to help!
@renatoniola1187
@renatoniola1187 5 жыл бұрын
nice Tutorial thanx, P.S. you are the only tutorial in my life that I had to slow down , normally I speed up to 1.25 / 1.5 even and with you is 0.75
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Haha just a week ago someone commented they were doubling the speed as it was boring, now you slow down.. I'm confused, but hope you still enjoyed it :)
@sumdaresloteng9013
@sumdaresloteng9013 5 жыл бұрын
Your course is amazing, I understand very well after watching your show, keep working on other tutorial videos maybe people can't pay you but God will pay you in kindness in another happy Working today
@caginbektas
@caginbektas 4 жыл бұрын
Thanks a lot! That was a very efficient tutorial.
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Glad it helped!
@wbaldisser
@wbaldisser 6 жыл бұрын
great tutorial, very clear and simple. Nice job!
@princeafrifa2787
@princeafrifa2787 5 жыл бұрын
hi Simon nice content there... i carefully followed the process but after changing the homepage to login the login didnt show in the browser.. did i do something wrong..... and will also appreciate if you can do a tutorial on how to integrate QR Scanner in ionic 4.....Thank you
@princeafrifa2787
@princeafrifa2787 5 жыл бұрын
ooooops sorry i guess i still had the homepage path in my routing module...thnx anyways
@sreevishal2223
@sreevishal2223 5 жыл бұрын
Brilliant tutorial..! thanks, man.
@techxpose5853
@techxpose5853 5 жыл бұрын
Thanx man, This video is very helpful for me
@brunobaptista3988
@brunobaptista3988 5 жыл бұрын
Brilliant as always, Simon! Thank you so much.
@vivekr.k7950
@vivekr.k7950 5 жыл бұрын
thanks for the lecture it's very use-full to me, if user already logged can we go to the home page without first open the login page?
@galaxies_dev
@galaxies_dev 5 жыл бұрын
You could have a check in your app.component and automatically route to the homepage then.
@sandeepjohnson6396
@sandeepjohnson6396 5 жыл бұрын
Thank you working perfect... But after login page referesh member dashboard page, why first display login page before the membee dashboard.. How can i slove..
@manishagrawal1697
@manishagrawal1697 5 жыл бұрын
@sandeep if you get any thing related to this plz ping i am facing same problem
@sandeepjohnson6396
@sandeepjohnson6396 5 жыл бұрын
@@manishagrawal1697 sure ...
@sandeepjohnson6396
@sandeepjohnson6396 5 жыл бұрын
@@manishagrawal1697 hey use this { skipLocationChange: true }
@axasoftware1494
@axasoftware1494 5 жыл бұрын
Thank you Simon , this was what I was looking for :) , keep the good job const :)
@MegaTokusatsu
@MegaTokusatsu 3 жыл бұрын
Really awesome. Remember to leave the code lines free of your screen face. Thanks!
@BDominikGT
@BDominikGT 5 жыл бұрын
Thank you for the good explanation about ionic and the router module. I would love to here something about ionic 4 and ngrx store and router. For example when is it good practice to use the ngrx router and the store together, or when is it overkill to use the ngrx router. Because the previous 3 ways to pass data with angular router is a nice explanation what and how to use, but now I'm wondering, what is the benefits of using the ngrx router too. I already using ngrx store with ionic 3. But now I'm creating a new app in ionic 4, so I try to stick with ngrx store, just don't know should I also use the ngrx router as well. Anyways, keep up the good work, and thanks for everything.
@Ali4276
@Ali4276 5 жыл бұрын
Hi Simon, Thanks for another great video. I have a problem when I click on register it go directly on login page but I resolve the problem simple with replace the href with routerLink, It's correct? Thanks
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Yes using the routerLink is always a good idea!
@furyformer
@furyformer 5 жыл бұрын
Solved it for me as well! Well spotted!
@sviluppoprogettoautomazion2746
@sviluppoprogettoautomazion2746 5 жыл бұрын
@@galaxies_dev Hi, new question: when I open the app with a token already in the storage, it login automatically, which is good, but for a brief moment it shows the login page, how to avoid showing the login page?
@sanjita3
@sanjita3 5 жыл бұрын
Hi Simon Grimm Thanks for tutorial ,I am getting error which was mentioned on last comment,could you please help me for error.
@assayem4090
@assayem4090 5 жыл бұрын
Thank you Simon , this helpful video ,
@ryanwu6889
@ryanwu6889 5 жыл бұрын
this help me a lot thanks!
@sviluppoprogettoautomazion2746
@sviluppoprogettoautomazion2746 5 жыл бұрын
Hi Simon, just a question: are there any alternative to the storage to store the login tokens? I have to access them basically all the time and several services require then token at the same time
@Bharatse
@Bharatse 5 жыл бұрын
Hello Simon, i followed your instructions and have implemented this in my app. But later i noticed that, the login screen flickers before redirecting to homepage, that is noticeable in your video as well. Is there a solution for that?
@omarquazi3740
@omarquazi3740 5 жыл бұрын
This is because the app first loads the Login component and then redirects. I am not sure how you would do this on Ionic 4 but when I used Ionic 3 I would do the authentication state check in the app components and not redirect to the login or dashboard until the check was complete. You should be able to implement the same in Ionic 4 but I am just not sure how, yet.
@genchiekadota9028
@genchiekadota9028 5 жыл бұрын
You can use canLoad instead of canActivate on routing-module to fix your problem.
@tanmayapatra6078
@tanmayapatra6078 5 жыл бұрын
Hey Simon, fist of all a big thanks for your helps through video tutorials. I just wanted a help from you. Can you please make a video for how can we do oAuth 1.0 Authentication API access by the use of Consumer Key & Consumer Secret ? Like the things used in Woo-commerce API. If you can make a video on Woo-commerce API and Ionic 4 then it will be a great help for me.
@naseebdangi3140
@naseebdangi3140 5 жыл бұрын
How can I add userInput to compare token and login if the token matches our default token for authemtication?
@DoubleD884
@DoubleD884 5 жыл бұрын
Hello guy , great video ...how to resolve the problem with register ? It doesn't work after login . Thanx
@galaxies_dev
@galaxies_dev 5 жыл бұрын
What problem with register do you mean?
@DoubleD884
@DoubleD884 5 жыл бұрын
@@galaxies_dev Nothing , I found the solution...i used href instead of routerLink
@kgermando
@kgermando 5 жыл бұрын
Thank you Simon
@marcoingo9726
@marcoingo9726 5 жыл бұрын
Hi Simon, great tutorial! I'm following your videos and you saved me a lot! I've a question for you: I've noticed a flashing effect when I try to open directly the /members/dashboard while I'm still logged-in. For a second I'm able to see the login page and then I'm redirecting to the "dashboard" page. Is it possilbe to avoid such effect? Thanks in advance! Marco
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Yes you could also use a Promise in your guard to wait until you get the result, and then there won't be a page shown before the result from storage is there. But this is a bit more complex!
@laurafalcon5741
@laurafalcon5741 5 жыл бұрын
@@galaxies_dev in guard service?
@laurafalcon5741
@laurafalcon5741 5 жыл бұрын
​@@galaxies_dev i need help, I have tried everything, but nothing works
@laurafalcon5741
@laurafalcon5741 5 жыл бұрын
Did you solve the error?
@khaliqseddiqi6652
@khaliqseddiqi6652 5 жыл бұрын
Hey Simon, I've watched your tutorial. Actually, it's awesome. But I faced an issue that whenever the user is authenticated the app shows the login page for a second, then jump to the dashboard page. Please tell the solution, cause I'm using it in a real application and I can not show the user the login page first.
@galaxies_dev
@galaxies_dev 5 жыл бұрын
You might need additional auth guard logic based on async value, because the BehaviourSubject always starts with false so the first value returned will always be that, which means the login appears. The topic becomes a bit more complicated then, but guards can also return Observables so that's the way to go then!
@1Thor61storm8
@1Thor61storm8 5 жыл бұрын
Great tutorial! I've been fighting with the login user flow and I reached a dead end: being in the browser, what if the user logs out, lands in the login page and then clicks on the back browser button? In my case, Guards do not trigger, authenticationState is now false (that's expected, user has logged out) but I can see the Members page. Any thoughts?
@galaxies_dev
@galaxies_dev 5 жыл бұрын
But if the memberpage is protected with a guard and the user is logged out, the page shouldn't open?
@1Thor61storm8
@1Thor61storm8 5 жыл бұрын
@@galaxies_dev You're right. I was on a Ionic tabs template and I only injected the Guard into the tabs father component, not the children, giving me the false impression that the guard did not trigger when navigating from tab to tab. My bad, sorry
@yiinsskibare5526
@yiinsskibare5526 6 жыл бұрын
Please, can you help us with ionic google maps native
@MarinelCuculj
@MarinelCuculj 6 жыл бұрын
Ionic 4 + JWT + php/mysql tutorial would be awesome :)
@galaxies_dev
@galaxies_dev 5 жыл бұрын
I'm actually a PHP noob I'm not sure if anyone wants to see me fail with it :D
@danielfasthuber5798
@danielfasthuber5798 5 жыл бұрын
Hi, Marinel did you find some tutorials on that?
@MarinelCuculj
@MarinelCuculj 5 жыл бұрын
@@danielfasthuber5798 Hi... I managed to do somenthing with: kzbin.info/www/bejne/nHaTapd-qpumhpI and github.com/firebase/php-jwt (I do hope I am allowed to post links in comments!)
@MarinelCuculj
@MarinelCuculj 5 жыл бұрын
@@galaxies_dev thaks you so much for all your videos! :) I enjoy watching them!
@vyshnavkumar3769
@vyshnavkumar3769 4 жыл бұрын
this was cool, I follow all your videos , but I have dought How to Keep Users Logged In to the App in ionic 4 ,I had done some work like storing the credentials like email and and cross-check the user in using api and the redirecting to the menu page but I am getting the login page for a few seconds and then redirecting to the menu page how to solve this, Actually its should directly open the menu page.
@galaxies_dev
@galaxies_dev 4 жыл бұрын
You can use canActivate guards and then e.g. check if a user is already authenticated and route them directly to an inside page!
@vyshnavkumar3769
@vyshnavkumar3769 4 жыл бұрын
@@galaxies_dev tq Will try this
@KochharAmandeep
@KochharAmandeep 6 жыл бұрын
Thanks a lot was waiting for this!!
@1998goodboy
@1998goodboy 4 жыл бұрын
is this something that would work or would be recommended to use with Firebase authentication?
@galaxies_dev
@galaxies_dev 4 жыл бұрын
This is a more general video, but should work with Firebase as well!
@CarlosSK
@CarlosSK 6 жыл бұрын
You know, How to create a login page before dashboard with tabs in ionic 4?
@Technbuzz1
@Technbuzz1 5 жыл бұрын
Where is the Angular Guard kicks, where the guards helps? I think every time all the job is done by initalizeApp() in app.component.ts
@galaxies_dev
@galaxies_dev 5 жыл бұрын
The guards are applied to the routes which use it with canActivate
@rachnasingh8976
@rachnasingh8976 4 жыл бұрын
Local storage value is not reflect on the page. But when i refresh the page value is reflected. Please reply
@RaveKev
@RaveKev 5 жыл бұрын
haha, watched that video to get the information, how to type in "/register" directly in the URL without geting thrown to login. Unfortunately, you had the same problem 24:04 . How would you fix it?
@galaxies_dev
@galaxies_dev 5 жыл бұрын
It's all about setting up the routing correctly - make sure you that no other route matches or strikes before you reach the entry for the register path - that's really the general idea behind it!
@sameerahmed7333
@sameerahmed7333 5 жыл бұрын
i am creating all pages in src/app and i want to navigate to tabs page in which have child page in app-routing.module.ts then how i implements this, can u explain plsss???
@yudinoviyandi2145
@yudinoviyandi2145 2 жыл бұрын
Login Flow with Angular Router for Ionic 6
@galaxies_dev
@galaxies_dev 2 жыл бұрын
You might like this: kzbin.info/www/bejne/iKbYgJecr55-rsU
@yudinoviyandi2145
@yudinoviyandi2145 2 жыл бұрын
Oke thanks 👍
@kell7491
@kell7491 6 жыл бұрын
why input component moves when on focus?
@saket-chaitanya
@saket-chaitanya 5 жыл бұрын
It would have been better if you would have explained the syntaxes which you typed rather than just speak what you are typing. We have to read everything what is written there to understand what these syntaxes are.
@kaushiklad6551
@kaushiklad6551 5 жыл бұрын
In ionic 4 latest ...i m able to make my demo app wich work fine on browser ..but in real device it has cors issue..i try so much but not able to solve it ...can u help me....i try ur login tutorial nice content ty
@galaxies_dev
@galaxies_dev 5 жыл бұрын
CORS happens because your Javascript is making HTTP calls to an API on a different domain. Either implement CORS on the server or use a proxy or use the Ionic Native package for native HTTP calls!
@codeaxen
@codeaxen 5 жыл бұрын
Simon Grimm Great Tutorials.....
@kagwad_in
@kagwad_in 6 жыл бұрын
Love you brother... brother please teach us food cart or shopping cart app
@rachnasingh8976
@rachnasingh8976 4 жыл бұрын
Hello sir, I am trying to make login using local storage. My side menu open in appcomponent.html file. i open my app then click on the login menu and enter the value and click pn the submit button then i storeted the value in storage but these value is not reflected in appcomponent.ts file. But when i refresh the page value is reflected. How can i solve this problem. Please reply
@Kinr.-.
@Kinr.-. 6 жыл бұрын
where the ng is used to generate that change is now used ionic
@surajitdas6555
@surajitdas6555 4 жыл бұрын
Auth guard need to declare in app.module that was the reason it was not working
@nizalshaonline
@nizalshaonline 5 жыл бұрын
Hi simmon, I'm getting this authenticationSate does not exist on type AuthenticationService
@renatoniola1187
@renatoniola1187 5 жыл бұрын
"Sate" ??
@lastpoint9488
@lastpoint9488 5 жыл бұрын
how to add input field dynamic in ionic3
@sarbudeenmca
@sarbudeenmca 5 жыл бұрын
Hi, in 15:55 how did you solved (this.authService.login is not a function) error please give link for solution.
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Then either the service was not injected or the function not yet created inside the service!
@poimsm
@poimsm 5 жыл бұрын
How to add firebase facebook login? My implementation is not working.. problems in the facebook native plugin..
@devendragaud831
@devendragaud831 5 жыл бұрын
When we directly go to the registration page, for a moment the login screen appears 24:30. I don't want that to happen. Is there a way to do that?
@galaxies_dev
@galaxies_dev 5 жыл бұрын
I'm working on a more complex example that prevents this behaviour using Observables in the canActivate guard :)
@gurnaibsingh7106
@gurnaibsingh7106 5 жыл бұрын
Hello sr some problem in ios build
@shafi2344
@shafi2344 6 жыл бұрын
Thank u.
@ayne99
@ayne99 5 жыл бұрын
How to change after login into tabs? i already watch ur video about How to Add A Tab Bar to Your Ionic 4 App and i have tried combine both of them, and when i click login button it's nothing happen. but when i go to localhost:8100/tabs its works without login
@poojamishra1505
@poojamishra1505 5 жыл бұрын
i just want to know Login Flow with Angular Router in angular 7 with ionic 4 please help
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Yes that's exactly what this video is about :)
@avijitguria8705
@avijitguria8705 5 жыл бұрын
NullInjectorError: No provider for Storage! how to solve it?
@hagarmohamad9634
@hagarmohamad9634 5 жыл бұрын
same here
@LuckystrikeGFXer
@LuckystrikeGFXer 5 жыл бұрын
I changed the import in app.module.ts from '@ionic/storage' to '@ionic/Storage' and imported "import { Storage } from '@ionic/Storage' " in authentication.service.ts and I dont get the error message anymore.
@LuckystrikeGFXer
@LuckystrikeGFXer 5 жыл бұрын
@@hagarmohamad9634 Look at my answer to the guy you commented on. Maybe it helps.
@brunobaptista3988
@brunobaptista3988 5 жыл бұрын
hello friend. i was facing the same error here. in the app.module.ts you have to import IonicStorageModule instead of Storage, then import IonicStorageModule.forRoot() same like here: ionicframework.com/docs/building/storage
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Yes you need to add it to your app module!
@profapps
@profapps 5 жыл бұрын
thank you Simon Grimm it's very helpful to me pleas give ass github.com project
@FangMarshalinRider
@FangMarshalinRider 5 жыл бұрын
the register button just refreshes the login page, i am not so sure what i did wrong here, i read over every bit.
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Hmm did you mix up some routing information maybe?
@GazohYEH
@GazohYEH 5 жыл бұрын
The only annoying thing is that whenever the guard is true that it first goes to the login page and than springs to the home page in my cenario. Like in the video 24:28 - 24:32
@galaxies_dev
@galaxies_dev 5 жыл бұрын
I see. You might be able to directly use Ionic Storage from the Guard and return a Promise instead. By doing this, it won't initially return false but really wait until we got the value from the storage!
@imanmanz
@imanmanz 5 жыл бұрын
hi, why i cannot put 'ng' command?
@imanmanz
@imanmanz 5 жыл бұрын
3:53
@galaxies_dev
@galaxies_dev 5 жыл бұрын
You might have to install the Angular CLI!
@MahmudulHasan-fi6xr
@MahmudulHasan-fi6xr 5 жыл бұрын
when I add this code in app.component.ts this.authService.authenticationState.subscribe(state => { // console.log('auth changed: ',state) if(state){ this.router.navigate(['members','dashboard']) } else { this.router.navigate(['login']); } }); all url under the access privilege. I can not access page, it redirect the login page
@surajkushwah4570
@surajkushwah4570 5 жыл бұрын
ERROR in Could not resolve module ./members/member-routing.module relative to app\app-routing.module.ts This is a error I am solving since 2 days
@galaxies_dev
@galaxies_dev 5 жыл бұрын
This means your path to the file is wrong!
@gurnaibsingh7106
@gurnaibsingh7106 5 жыл бұрын
api is not work in iphone
@jhonstivenguevaravelasco8482
@jhonstivenguevaravelasco8482 6 жыл бұрын
ng generate module members/member-routing --flat As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release, which will only support Node 6.9 and greater. This package will be officially deprecated shortly after. To disable this warning use "ng set --global warnings.packageDeprecation=false". The option '--flat' is not registered with the generate command. Run `ng generate --help` for a list of supported options. You have to be inside an angular-cli project in order to use the generate command.
@jhonstivenguevaravelasco8482
@jhonstivenguevaravelasco8482 6 жыл бұрын
ionic g module members/member-routing --flat
@hansschenker
@hansschenker 6 жыл бұрын
Most valuable content - but not carefully presented! To my taste the errors could be corrected before publishing, they are irritating and annoying! But anyways thank's for making this content public :-)
@galaxies_dev
@galaxies_dev 6 жыл бұрын
Hey Hans, yes you are right. I can do more copy/paste to prevent them but with livecoding it can happen. But I'll definitely cut out most of the error searching in all future videos!
@tanmayapatra6078
@tanmayapatra6078 5 жыл бұрын
@@galaxies_dev You should show how you are solving the errors, from this most of the developers will get the idea to solving the errors.
@Venkatyful
@Venkatyful 5 жыл бұрын
Sir please teach slowly as i am not so comfortable with authentication and all that
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Sorry, will try to do hard things a bit more slowly next time!
@k3logics925
@k3logics925 5 жыл бұрын
Simmon, why your video code and documented code available at devdactic.com/ionic-4-login-angular/ are different. That would be very helpful for all the viewer and users, if you could provide tutorial code on github. Thanks a lot.
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Normally the code is 99% the same, maybe I only changed a few things due to a different Ionic version!
@jdotsystem
@jdotsystem 5 жыл бұрын
Nonsense, you should learn server structure for the client application If I was you, I created the login check screen between the login screen and main screen Do you know this meaning?
@galaxies_dev
@galaxies_dev 5 жыл бұрын
I don't understand your rude tone in here? This is a simple example without a backend.
@rajathedav1258
@rajathedav1258 5 жыл бұрын
please reply for it
@rajathedav1258
@rajathedav1258 5 жыл бұрын
you are doing so fast beginner can't understand it properly.Make it little slow for us.
@galaxies_dev
@galaxies_dev 5 жыл бұрын
Sorry, will try so next time!
@renatoniola1187
@renatoniola1187 5 жыл бұрын
you can slow down in youtube
@الحمدلله-ط8ز1ذ
@الحمدلله-ط8ز1ذ 5 жыл бұрын
Thank you ..
@islamabdugafarov3308
@islamabdugafarov3308 5 жыл бұрын
NullInjectorError: No provider for Storage! , How connect login with tabs?
@galaxies_dev
@galaxies_dev 5 жыл бұрын
You need to add IonicStorageModule to your app.module! And you can simply have a login page before navigating to the tabs routing file of your app!
@islamabdugafarov3308
@islamabdugafarov3308 5 жыл бұрын
@@galaxies_dev thanks i have use firebase after
How to Create a Simple Ionic 4 Firebase App with AngularFire
26:07
How to pass Data to Ionic 4 Modals, Pages & Popover
17:58
Simon Grimm
Рет қаралды 58 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 68 МЛН
Это было очень близко...
00:10
Аришнев
Рет қаралды 7 МЛН
Friends make memories together part 2  | Trà Đặng #short #bestfriend #bff #tiktok
00:18
Building an Ionic 4 JWT Login with Tab Bar & Angular Routing
31:00
Learn Express JS In 35 Minutes
36:03
Web Dev Simplified
Рет қаралды 839 М.
How to use Ionic Route Guards and Resolver [v4]
20:03
Simon Grimm
Рет қаралды 11 М.
How to build a REST API with Node js & Express
58:40
Programming with Mosh
Рет қаралды 1,7 МЛН
Angular Crash Course | Learn modern Angular in 90 minutes
1:29:09
Code with Ahsan
Рет қаралды 8 М.
10 Tools & Services Every Ionic Developer Should Know
21:25
Simon Grimm
Рет қаралды 26 М.
Next.js 15 Breakdown (Everything You Need To Know)
18:10
Web Dev Simplified
Рет қаралды 62 М.