AngularJS/PHP User Authentication Code Along

Php

Video is ready, Click Here to View ×


PART 2 is now up 🙂 https://www.youtube.com/watch?v=RQE0SU3TRqw

Today’s Tutorial goes over how to implement user authentication on a single page application with AngularJS and PHP/MySQL. Source code for this tutorial can be found at https://github.com/techwarriorz/PHP_AngularJS_Authentication_Tutorial/tree/master

Keep in mind that this is very basic, with minimal security… however it is enough to get you up and running!

If you like the video please subscribe! For daily tech news please…

36 thoughts on “AngularJS/PHP User Authentication Code Along

  1. Firstly thanks for this video. This video helped me.

    But I have a question. How we build secure applications angular like frameworks? Because you know, we need sessions to crud operations.

    For example, I'm hacker. I posted XSS code to database like this:

    <script>alert(localStorage.user.username)</script>.

    When users open the page, they'll first see an alert. This is so basic example. Their informations could be sended another server with XHR, Ajax blah blah..

  2. Hey I am trying to store data in database through PDO. But facing error(Warning: PDO::__construct(): MySQL server has gone away in C:wamp64wwwMyDemoAngularPHPconnection.php on line <i>8<). Do I need to install PDO driver. I am using wamp64.

  3. HI..Bro ,
    Thanks for your tutorial,
    i am tried to follow you but i am getting this error in console.

    <b>Fatal error</b>: Call to a member function execute() on boolean in <b>C:xampphtdocsLogin-with-Phpsignup.php</b> on line <b>10</b><br />

    Plz help me how to solve this..!

  4. A really BIG THANKS to you! I really wanted to learn AngularJS because of how well it integrates with PHP, trust me I tried but gave up hope because it never really made sense to me. THANKS, you the man!

  5. Nice video bro, for me is not so simple btw, as for everyone approching it i think ehehe.A question Is this gonna work cross browser? In mobile with angular js + cordova on a PHP backend?

  6. Hi TechWarriorz can explain to me this line $check = $db->query("SELECT * FROM users WHERE token=$token");, because, I was reviewing you table "user" does not contain the token column, ¿its a funtion de mysql ?
    I'm sorry, me English is no very go lucky

  7. Hello, thanks for this tutorial, however I have a question, is it really okay to check if user is logged in on client side? what if someone tangles with localStorage['user']? wouldn't it be possible to break into any account?

  8. How would I use password_hash here instead of sha1?
    for signup I use
    $hash = password_hash($password, PASSWORD_DEFAULT);
    and store the $hash in the password in my db, but how do I use the password_verify in the login? I've been trying for hours now and can't make it work.
    We both know sha1is not so secure compared to the password_hash function

  9. Hi body,
    To control if the user is logged in you did this:
    "if (localStorage['user'] === undefined){
    $state.go("login");
    }"
    But in my case, I gonna check if the user exists in my database. So I have to change localStorage['user'] for what?

  10. dude wtf, i was looking for something like this, i have already a project u know something simple, a CRUD with php pdo javascript and ajax i was looking how to make that crud with angularjs and then i found this tutorials ty so much for share keep the good work

Leave a Reply

Your email address will not be published. Required fields are marked *