User authentication using AngularJS, PHP, MySQL


I received a number of tutorial requests to publish a tutorial on user authentication. They say “Mixing PHP, MySQL, and AngularJS with Sessions and User Login, Logout, Account Creation” would be awesome”.

We will create a simple AngularJS web app that will have the following 3 functionality.

 Login, Signup and Logout.

We will create a ReSTful web service using PHPSlim framework as data provider. The data from the ReSTful service will be used to enable user authentication in our AngularJS application.


Live Demo Download

To run the user authentication web application in your local machine, follow the following 3 simple steps.

  • Download the project files
  • Import angularcode_auth.sql
  • Enable rewrite_module in apache server for friendly urls


We will first create the Login page. After the user enters the correct combination of email and password, it will be authenticated from the credentials stored at our MySQL database. On successful login it will store the credentials in the user session and redirect to the welcome page. All subsequent pages browsed after login will have access to the user information.

Upon unsuccessful login or logout, the app will redirected the user to the login page.

We will use the elegant AngularJS-Toaster plugin to communicate to the user easily.

For this application we will also create some simple AngularJS directives for our SignUp form.



Representational state transfer (ReST) is a software architecture for www. Distributing the data to different kind of applications becomes convenient using this architecture. It produce status code response in JSON or XML format.


We will create following 5 folders to manage our code effectively.


api [ This directory will serve as our restful data provider ]

–          config.php [ Database configuration information ]

–          libs [ The PHPSlim library files ]

–          v1 [ This folder controls our API version ]

—   .htaccess [ used to convert urls to user friendly url]

—   passwordHash.php [ Generate password hash ]

—   dbConnect.php [ The function to connect to MySQL Database ]

—   dbHandler.php [ This file contains some database helper functions ]

—   index.php [ The starting point of the API ]

—  authentication.php [ Contains functions for user authentication, login, signup, session ]


–          app.js [ The main angularJS file that controls routing and authentication ]

–          authCtrl.js

–          data.js

–          directives.js


–          bootstrap.min.css

–          custom.css

–          toaster.css

js [ This directory contains required javascript libraries ]

–          angular.min.js

–          angular-route.min.js

–          angular-animate.min.js

–          toaster.js

partials [ Contains our partial pages that will be served based on user request ]

–          login.html

–          signup.html

–          dashboard.html

index.php [ Starting point of our application contains css files, javascript files and ng-view placeholder to serve all requested partial pages ]


All the API files required to create the ReSTful webservice is stored inside the “api” directory.

The only file you need to change is the “config.php” [ This file contains the database login information. Put your database credentials here ]

define(‘DB_USERNAME’, ‘root’);
define(‘DB_PASSWORD’, ”);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_NAME’, ‘angularcode_auth’);


Also we need to import the “angularcode_auth.sql” file into our MySQL database



Now our data provider is ready. Let’s create the starting point of our application (index.php)

This file contains the required stylesheet and javascript files with the placeholder to serve partial pages

We will create and store all our custom AngularJS code files inside the app/ directory

app/ app.js

This is the starting point of our AngularJS application. Here we will load the modules and configure the route provider.

app / data.js

We will communicate with our ReSTful API using this file. This file contains some helper functions and acts as our service provider.

AngularJS Service

Sometimes while building our AngularJS application, we need some variables or functions to be accessed throughout our application from any controller. Here comes the role of AngularJS Service. As AngularJS Service services are single-tone, the defined properties and functions can be accessed from anywhere.

app /authCtrl.js

This is the controller which communicates with our front end.


app / directives.js

This file contains 2 custom AngularJS directives we used for our application.

focus – This directive focus on the desired form element on page load

password-match – Used to check if both the password and confirm password are same in our user signup page.


AngularJS Directives

Directives are one of the most powerful part of the AngularJS framework. Using these we can create or extend the html elements.

We can extensively use these AngularJS directives to create templates, to validate forms, etc.

In AngularJS, it is always recommended to manipulate the DOM using directives only.

Print Friendly

Related Posts

Written By:
  • lulu prat


    your demo is interesting unfortunatly i can’t use it on my server. i get this error when i try to sign in:

    Not Found

    The requested URL /angularcode-authentication-app/api/v1/signUp was not found on this server.

    Apache/2.4.7 (Ubuntu) Server at localhost Port 80

    Wath is wrong?

    • itswadesh

      Hello Lulu,

      Probably you did not enabled Rewrite_module in apache

      • nordy


        mod_rewrite is loaded and a htaccess file is into directory with RewriteEngine on

        I think there is a problem must be fixed.



        • Michel

          I think that’s to do with your .htaccess, Bulcsú pointed out the solution.

  • Jeff Hiatt

    I get different errors. I do have MOD_REWRITE enabled in apache. I didn’t see anywhere that explained where to put the root of this project. So I added a symbolic link from the root of my apache documents. The login page loads just fine. It finds all of the .css, .js and the partials. However when it attempts to go to check the session or to add me as a user, I get 404s:

    Get http://localhost/angularcode-authentication-app/api/v1/session 404 (Not found)
    Post http://localhost/angularcode-authentication-app/api/v1/login 404 (Not found)

    the signup page loads as well.
    The home (login page) loads at http://localhost/~myusername/demo/#/

    and the signup page loads at http://localhost/~myusername/demo/#/signup

    I’ve tried changing the serviceBase in data.js to “/~myusername/demo/api/v1/” – that doesn’t work either. But at least the url looks correct:

    Get http://localhost/~jlhiatt/demo/api/v1/session 404 (Not found)

    Any ideas?

    • itswadesh

      I think you need to import the .sql file into your database and provide the correct database credentials into the application config file?

      • Jeff Hiatt

        I had the db user / password correct. I was putting the project in a directory, and mapping the directory in the httpd.conf. However it didn’t start working until I created a in httpd.conf. Now it works. I can signup and login.


        • Alif Rio Utama

          can you post your virtualhost setting here? i’m getting stucked at this point please.

  • MIki

    I can still acess to dashboard even if I’m logged in , but do redirect after a few seconds. Is it problem with a rout provider function ?

    • itswadesh

      True. We can find a solution for this.

  • MIki

    *log out, sorry

  • Kico

    I have an appache hostet server, but theres a problem to signup!
    Yes, I’ve buildup the DB and table with the provided SQL code (connection well, no errors)
    Nothings happen when Im trying to sign up (all fields correctly filled), no error, no message…

    What Im doing wrong?

    • itswadesh

      Please check the browser console and let me know if there is any message

      • Kico

        No, theres no message at all.
        Can I send you the link (private) so you can check it by your self?

        • itswadesh

          Please do send me.

          • Kico
          • itswadesh

            Application seems to be correct. There is some issue with your web server. Probably you need to allow MOD_REWRITE and AllowOverride All in your web server.

          • Kico

            Hi, I have insert this into my htaccess file and put it into the main folder, and nwo I got an 500 error?

            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted

  • AlainD.

    Hi, for the ones having issues with the MOD_REWRITE module in apache, do not forget to allow also the override in your DocumentRoot (or your virtualhost) with the directive:
    AllowOverride All
    instead of AllowOverride None !
    otherwise it won’t work.

  • AlainD.

    Hi, If I want to use a JAVA client to access the api, How is the best way to do it please ? How do I format the http request ?
    Thank you.

  • Matthias

    Hello! I have the same issue. 2 Files are missing:


    Can you explain, what this files doing? Because they don’t exist..
    When will they be created ?
    I am a newbe, but all your Tuts are great and works fine so far. My only change in this app is a change in the database name, but thats not the problem i think. The Allow override thing, is also set to All.
    Hanks for help! and more Tuts are welcome 😉

    • AlainD.

      There are no such files! These url are resolved by the override directives in the .htaccess. You should check your server configuration if it’s not working properly for you.

      session and signUp are get and post methods of the authentification service.

      • Erica Peharda

        Hi Alain. I’m using ipage hosting services for my site and I’m having this same issue. The server’s MOD_Rewrite is set on (according to the support at iPage). Do you have any other ideas what it could be? My code is up on github at


        • AlainD.

          it could be the .htaccess inside your mattcoaching/api/v1

          You copied the following line:
          RewriteBase /angularcode-authentication-app/

          without modifying the name of the application.

          Change ‘angularcode-authentication-app’ by the base url of your app installation. (/mattcoaching/ maybe ??)

          • Erica Peharda

            Oh, great! I thought of maybe doing that, but wasn’t sure. I just updated this (they display the base url in my php editor). I appreciate it! I’ll let you know if this works.

    • itswadesh

      Those urls are generated at “api/v1/authontication.php”

    • matthias

      Thanks Guys! Don’t work so far. Already on page load he missed the session “cookie”
      Maybe its to tricky for me..
      Or do i have to download and integrate the slim php framework?

    • Bulcsú Bargel

      Modify .htaccess at /api/v1/:

      RewriteEngine On
      RewriteBase /angularcode-authentication-app/
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]

  • Felipe


    How can I change the dbConnect.php for connect a postgres database? Does Slim framework support that Postgres?

  • Akoy

    Hi guys,

    Is that possible to mix this code with the CRUD restful php service.
    I try to do it but it doesn’t work.
    Do you have an issue for that


    • itswadesh

      This example uses a CRUD restful php service. The service is called from the Data.js page

      • Akoy

        thanks for your answer. Can use CRUD for authentification and CRUD for customers in the same file(mix) or do i have 2 differents files.

  • bg

    That’s cool. What about improve this example with JWT authentication?

  • batman

    Sir if i want to add CRUD operations in this code , how am i suppose to do that ?
    Shuld i make a new controller like auth.js or work in it

  • batman

    can you kindly guide how to add CRUD operations in this example

  • neeli

    Crud operations of different table

    my user table is differrnt and i want to add CRUD operation of Books table , but i want my logged in user to add delete update read search from Book table, how am i suppose to that , kindly reply help needed

  • Mel

    The SQL definition for ‘customers’ above is incorrect; it should specify a table name of ‘customers_auth’. Otherwise the application fails silently

  • Avi Zuber

    Thanks for the awesome tutorial. How do you make the uid available in other controllers? It seems to be defined as a rootScope variable, but it is not available. I tried this:

    $scope.getGoal = function (results){

    Data.get(‘session’, {

    userId : results.uid



    but it didn’t return anything (no errors). Also, any reason why you’re using “Data.get” instead of “$http.get”?

    Thanks again!

    • Avi Zuber

      Basically I need the uid so I can submit it as part of a form. I need it available on root so it can be used as part of an ng-model. Thanks!

      • Bo Diddley

        you can access via your rest api sown together with controller then use this controller where you need access to uid

  • dunods

    hello i have a question, why that once i change db host to the db ip cant work ?
    ex db host “localhost ” -> “”.


    • Bo Diddley

      what is IP of your web server accessing

  • Shevy

    I’m trying to combine this with the product manager to build something but I’m having trouble with the mysqli vs PDO. I’m a front end dev and I’m having trouble getting the combination to work.

    • Bo Diddley

      can you expound a bit more your question please?

    • Fabio Sereno

      Hey Shevy, did you get anywhere with this implementation ? as I am now trying the exact same thing. Many thanks.

      • Shevy

        I didn’t figure it out. I actually ended up learning C# and am working with that.

    • If any cares, I figured out using this with the product manager and setting it up with PostgreSQL using PDO

  • loud rooster

    I’d like to place “logout” link into navbar in index.php, but it des not work… I guess that you cant access authCtrl.js outside ng-view. Can someone help me to modify this script so that ng-click=”logout();” works from index.php?

  • Philip Ryan

    You might need to add the PORT to the database connection file, so add a define('DB_PORT', 3306); to the config.php file, and also add the DB_PORT to the connection request in the dbConnect.php file, i.e.

    $this->conn = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_PORT);

  • Mirchu

    nice tutorial, i will start angular JS with PHP and MYSQL 🙂

  • Cristina

    Awesome work. Thanks for the codes it works fine and perfectly. This is what I needed right now. 🙂

  • manojkumar

    iam new to this particularly unable to login or signup getting info empty message.may i know what is the problemguys?

  • Kim

    This is insecure, I still can find a way to easily access /dashboard without login. Use Oauth2 is a better way to go.

  • Nishanth

    Hi. I cant download the project. It is showing

    “The requested URL was not found on this server.”
    Can you please look into that link.
    Your tutorial is very good for the beginners by the way.

  • Ananthi

    I cant to find output.clear my doubt.


    background-color: lightblue;












    header(“Location: empdb.php”);


    echo “Invalid user”;

    //header(“Location: indexlog.php”);


    body {
    background-color: #d0e4fe;

    h1 {
    color: orange;
    text-align: center;

    p {
    font-family: “Times New Roman”;
    font-size: 20px;
    tr {

    Employee Details


















    echo "INSERT INTO empdetail(empname,gender,username,password,qualification,langknown,address) VALUES('$empname','$gender','$username','$password','$qualification','$langknown','$address')";

    $sql="INSERT INTO empdetail(empname,gender,username,password,qualification,langknown,address) VALUES('$empname','$gender','$username','$password','$qualification','$langknown','$address')";


    echo $result;

    echo "Inserted successfully";



    $query=mysql_query("SELECT * FROM empdetail");


    while ($row = mysql_fetch_array($query,MYSQL_ASSOC))




    echo "”;

    echo “”.$row[’empname’].””;
    echo “”.$row[‘gender’].””;
    echo “”.$row[‘username’].””;
    echo “”.$row[‘password’].””;
    echo “”.$row[‘qualification’].””;
    echo “”.$row[‘langknown’].””;
    echo “”.$row[‘address’].””;
    echo “Delete”;
    echo “

    echo “”;







    // if($_REQUEST){

    // $empname=$_POST['empname'];

    //$query=mysql_query("SELECT * FROM empdetail");


    //while ($row = mysql_fetch_array($query,MYSQL_ASSOC))




    //echo "”;

    //echo “”.$row[’empname’].””;
    //echo “”.$row[‘gender’].””;
    //echo “”.$row[‘username’].””;
    //echo “”.$row[‘password’].””;
    //echo “”.$row[‘qualification’].””;
    //echo “”.$row[‘langknown’].””;
    //echo “”.$row[‘address’].””;
    //echo “Delete“;
    //echo “Edit“;

    //echo “”;


    I got this output only.


  • Frank Kabinoff

    good stuff. thank you

  • Narayana

    Hello, can you explain me how do i connect CURD api to this login fo

  • Narayana

    Failed to load resource: the server responded with a status of 500 (Internal Server Error) when I submit sign up from

  • Fabien


    how can i catch this error, because there is no status / message :

    data.js:12 data: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Audenarde’)’ at line 139

    data.js:13 data.status:[ undefined ]

    data.js:14 data.message:[ undefined ]

    I know the problem. I have a ‘ in the address.


  • heang

    Hello, Why I can not click on navigation on the top right on mobile device when I show on live demo?

    • rusty

      If using bootstrap you might need to make sure you have included jquery

  • Rodrigo

    cannot load . already changed the .htaccess file and it did not work

  • Дмитрий Кабардинов

    Good, day. Can you explain why use this strange construction?
    if (nextUrl == ‘/signup’ || nextUrl == ‘/login’) {

    } else {

    It makes you question quality of the rest codebase of this tutorial…
    Siriously, why don’t just

  • Ivan Ferrer

    thanks for this great tutorial. This is the kind of thing that discourages me of creating more websites. Now I have a good template.
    I found a little mistake in authentication.php line 8, where it says
    echoResponse(200, $session);
    I think it should echo $response instead.

  • exal

    any suggestions to avoid this?

  • ren

    Where is the LogoutCtrl?

  • ren

    Does anyone have a copy of the dbHandler.php I can’t clear the session in the logout portion

  • freedman

    can anyone help me?

    it’s work in localhhost but dont working on ftp server site!!

    rewrite_mod enabled to config.php ..

  • Cenk

    hi im trying to use this app, but i get the following error:

    GET 404 (Not Found)
    GET 404 (Not Found)
    GET 404 (Not Found)

    i uploaded all the files from github source.
    if i want to login i get blue information toaster and nohing else

    • Cenk

      i added the files, the error code is gone, but i cant stil loggin. If i want to login or signup i get blue info toastr. without redirecting to dashboard

  • Alpesh Trivedi

    Hello ! I am newbie in AngularJS. I have one question. How do I upload file with other data in registration script

  • Foysal

    I could not install this project in my PC. Can anyone help me to install this project ?? Thanks

  • dskanth

    Do i need to modify the .htaccess file ? My browser’s console shows some “.map” files missing. Else, the tutorial is really awesome.

  • Jonatha Lima

    I need Help, I can’t load this project. angularcode-authentication-app/api/v1/session 500 (Internal Server Error). How to install this project ?

  • freedman

    have anybody used angular JS?
    database is easily connected to host server by local but it hasn’t been connected by server itself to database

  • freedman

    have anybody used angular JS?
    database is easily connected to host server by local but it hasn’t been connected by server itself to database

  • Irfan Efendi

    thanks for tutor

  • kartik

    It’s working ! Thanks. But can you explain using some video tutorial? so that, it will be easier to understand.

  • hacker9

    Can you edit it to use UI-router instead of ng-router?

    • NationalAcrobat

      Hello! You can simply modify the ngroute parts to state (eg.: routeChangeStart). Of course it requires a basic understanding of angular ui-router flow. I’ve done it in 15 mins so not so hard.

  • dk4210

    I am having the same issue with the session and login. i know that it is referenced in authentication.php. The issue is I’m on a iis (windows) server and i understand that it requires htaccess, which of course my server doesn’t use.

    I converted this
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]

    to This

    But still no luck, so the 2 questions I have is
    1. Should the web.config be only in the v1 folder?
    2. Is there anything else I can do?

    Thanks in advance for your help.

    • Shijith K.M

      I am also facing the same issue , please help

  • Stephan Vermeire

    I’m having some doubts about the level of security. it’s easy to access part of the dashboard with the direct link:


    Of course this provides just part of the page but still….

    The php include mechanism appears to be much stronger since all security coding is handled on the serverside.

    • khaleelm

      Examples of fixing this?

  • Vijai

    Hi thanks for the nice tutorial, i have one issue,if i logged the session was successfully set but if click on home page its redirecting to login page i don’t want to go to login page if session was set.

  • RD

    Great little how-to guide, learned a lot, will be using bits and pieces of that code for a while, so thanks!

  • Ossi Pesonen

    This method actually is not that great. You get a flash when trying to access a route which is for logged in usres only. You should use resolve on a route to actually check if a user is logged in so the template does not get loaded when promise is not valid.

    • khaleelm

      Any examples?

      • disqus_euNDtnY32a

        // in your router do this

        .when(‘/dashboard’, {
        title: ‘Dashboard’,
        templateUrl: ‘partials/dashboard.html’,
        controller: ‘authCtrl’,
        resolve:[‘checkAuth’, ‘$q’, function(checkAuth, $q){
        var deferred = $q.defer();
        return deferred.promise;

        // then add a factory

        app.factory(“checkAuth”, function(Data){
        return function (deferred) {
        Data.get(‘session’).then(function (results) {
        if (results.uid) {

        • Asım Sinan Yüksel

          This solves the routing problem. Perfect. Thank you 🙂

  • ishan

    how can I use the logout button from main page after logging in?It should terminate the session and redirect back to login page..I cannot find logoutCtrl controller..thanks!!

  • Promising Networks

    Free Web Hosting
    Visit –

  • Promising Networks

    50% Discount on unlimited web hosting
    Visit –

    Use Coupon Code – PNS50OFF

  • Pingback: No 'Access-Control-Allow-Origin' header is present - DexPage()

  • Sagar Guhe

    How can I logout without clicking “logout” button and simply by going to the url viz. #/logout?

  • Matt

    My web page is not showing any errors, but when i try to login or create an account an empty toaster box pops up. Do you have any suggestions for debugging? How do I determine if my database is connected (using rds) and how do I know if my submissions (login or signup) are utilizing the Restful API?

    • Francesca Bradley

      I noticed this too, turns out it is because in the sql file the table is named user_auth, but in the authentication.php it refers to customers_auth as the table name. Just change it so it matches and you should be all good.

    • Jason Martinez

      Did this work Matt I am getting the same and in authentication and SQL file it is customers_auth?

  • Graham Zuber

    Hey! I loved this tutorial, it helped me out a lot in understanding authentication in a web app that I’ve been developing.

    In the course of learning angularjs, I’ve discovered the $routeProvider resolve property and wanted to suggest it as an alternative to binding to the routeChangeStart event.

    Obviously, it depends on how protected you really need your data and how many routes you need to protect – but the resolve property allows you to redirect any unauthenticated or unauthorized attempts to access the information before any information was displayed on the page. The ONLY issue I noticed with this method is the brief flicker on information being displayed on the page before the routeChangeStart event determined that they’re not authenticated/authorized.

    But it was a great tutorial, it helped me out a lot.

  • Fabio Sereno

    This is really great starting point for Angular and a login app. Has anyone implimented a “Reset” option with this app ? I need the user who has logged in able to reset their password. Any ideas ? Many thanks in advance.

  • Fabio Sereno

    his is really great starting point for Angular and a login app. Has anyone implimented a “Reset” option with this app ? I need the user who has logged in able to reset their password. Any ideas ?

  • tanveer

    you should enable

    Simple you : Enable rewrite_module in apache server for friendly url

  • Gaurav Kumar


    First of all i would like to thank you for posting this such a helpful code .I am using this code in my project but i am using Rest API using CodeIgniter framework .

    I have made few changes into your code which is in the factory method .

    here is the updated code .

    app.factory(“Data”, [‘$http’, ‘toaster’,’$log’,

    function ($http, toaster,$log) { // This service connects to our REST API

    var serviceBase = ‘’;


    var obj = {};

    obj.toast = function (data) {

    toaster.pop(data.status, “”, data.message, 10000, ‘trustedHtml’);


    obj.get = function (q) {

    return $http.get(serviceBase + q).then(function (results) {



    }; = function (q, object) {



    method: ‘POST’,

    url: serviceBase + q,

    headers: {

    Accept: “application/json”,


    data: object.customer


    .then(function (results) {





    obj.put = function (q, object) {

    return $http.put(serviceBase + q, object).then(function (results) {




    obj.delete = function (q) {

    return $http.delete(serviceBase + q).then(function (results) {




    return obj;


    Now my concern is to create a separate factory for my another function like for now as you used post method for login and signup but i would like to use post method but in different function similar to

    For Login ——————– = function (q, object) {



    method: ‘POST’,

    url: serviceBase + q,

    headers: {

    Accept: “application/json”,


    data: object.customer


    .then(function (results) {





    For Sign up ………………. = function (q, object) {



    method: ‘POST’,

    url: serviceBase + q,

    headers: {

    Accept: “application/json”,


    data: object.customer


    .then(function (results) {





    How could i make this separated ?

    much appreciated


  • khaleelm


    Thank you for this brilliant tutorial. Would love to see some cart and ecommerce examples from this. Maybe a series. I have used some of the ideas here; personally I think that it is slightly insecure as the dashboard appears slightly … for mobile app it would be better as customers do not know the URLs

    Please can you provide this though logoutCtrl as it is missing

  • khaleelm

    Nevermind. Fixed the logoutCtrl issue. this is my code:

    zApp.controller(‘logoutCtrl’, function ($scope, $rootScope, $routeParams, $location, $http, Data) {
    $scope.expr = variables;
    $scope.logout = function () {
    Data.get(‘logout’).then(function (results) {

  • Salsicha

    Any chance of make a post teaching how to migrate this to PDO?

  • Petrone Thiago

    why can’t I download the files of this project?

  • Tia

    can you upload this somewhere else please? The download from BOX didn’t work 🙁

  • Petrone Thiago

    Thank you very much for making this available again

  • Amit Singh

    Super Example… I was new bird for angular and this example help me lot to understand the server side connectivity and handling the session. Thanks a ton.

  • tom

    how can i update password in this app ? plz help

  • Pingback: How to upload image along with other data in AngularJS | Questions()

  • Luqman Hakim

    it’s seem that using firefox 42 is slow when logging in, but using chrome Version 47.0.2526.80 m is very fast..

  • Selva Kumar

    Can you please share how to send mail confirmation once the user has done registration?

  • Sreelalitha K

    Ur demo is working fine, but the code downloaded not working on submit it is returning html present in php slim not at all working as shown in demo link. It would be great if you help
    Thanks in advance

  • Sandeep Kumar Singampalli

    Thankyou very much
    Great tutorial
    1st I didnt on rewrite engine the data present in your .htaccess is correct
    here in replies for the 1st comment is stopping application to work

  • Pingback: javascript - No 'Access-Control-Allow-Origin' header is present - javascript()

  • Putrayol

    greate tutorial, can you help me, how to get output json, when i try using postman, i can’t generate json format, the output is html…can you you tell me what i must change or add in your code…thanks.

  • vbsuthar

    i am still facing the issue after URL rewrite in my .htaccess file the error i am getting in my console is like “http://localhost/angularcode-authentication-app/api/v1/session 500 (Internal Server Error)” kindly help me to resolve this..

    • Larry

      A quick fix for this is to edit “data.js” and change this:
      var serviceBase = ‘api/v1/’;
      To this:
      var serviceBase = ‘api/v1/index.php/’;

  • subash khati

    I get this error: Required Fields email, password is missing while trying to login. It works fine with postman.

  • subash khati

    How do I implement facebook login along side this app. Thanks

  • T S

    Thanks for this! You helped me figure out a great foundation for a project of mine, your sample also effectively taught me about ngRoute, and prompted me to create a pseudo API from my backend to work together with my new frontend. Very happy I stumbled across your tutorial.

  • Kenneth Odoh

    Kindly describe how to make the login view and signup use https rather than http. Please provide code snippet.

  • nusrat afrin

    I am unable to login/signup…
    In console I’m getting this error api/v1/session 404 (Not Found) angular.min.js:77

  • sonali dhasal

    i am using ionic framework i want to send and receive data from hosting serve side. so what we do. my all php file present in server so how could i access that file.

  • Pingback: Google()

  • Emmanuel Salazar Paz

    It works Perfect, the table is customers_auth

  • Larry Irwin

    I’ve got this working quite well merged into a dynamic CRUD app… There appears to be a built-in timeout for the session. Is there anything in the session that can be manipulated concerning things like “valid until [timestamp]” or “idle out after [xxx] minutes of inactivity”? (it may be something else is invalidating the session, but it appears to be a timeout of some sort…)

  • arwaaz

    signup and login button is not working??

  • rahul

    how do i athenticate by sending mail confirmation and also forget my password …plz help

  • K Denny

    Do you have any suggestions on a simple user administration page to compliment this? I have used some of your code and it has been great! Thank you so much for posting this and assisting us developers in learning 🙂

  • Puja

    demo was working f9 but when tried to execute on local got following errors:

    Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    please let me know how to resolve it ? i tried the suggestions mentioned below but it didn’t worked…

  • Sheldon Eristee

    Slim Application Error

    The application could not run because of the following error:
    Type: ErrorException
    Code: 2
    Message: session_start(): Cannot send session cache limiter – headers already sent
    File: /Applications/MAMP/htdocs/angularcode-authentication-app/api/v1/authentication.php
    Line: 29

    #0 [internal function]: SlimSlim::handleErrors(2, ‘session_start()…’, ‘/Applications/M…’, 29, Array)
    #1 /Applications/MAMP/htdocs/angularcode-authentication-app/api/v1/authentication.php(29): session_start()
    #2 [internal function]: {closure}()
    #3 /Applications/MAMP/htdocs/angularcode-authentication-app/api/libs/Slim/Route.php(436): call_user_func_array(Object(Closure), Array)
    #4 /Applications/MAMP/htdocs/angularcode-authentication-app/api/libs/Slim/Slim.php(1307): SlimRoute->dispatch()
    #5 /Applications/MAMP/htdocs/angularcode-authentication-app/api/libs/Slim/Middleware/Flash.php(85): SlimSlim->call()
    #6 /Applications/MAMP/htdocs/angularcode-authentication-app/api/libs/Slim/Middleware/MethodOverride.php(92): SlimMiddlewareFlash->call()
    #7 /Applications/MAMP/htdocs/angularcode-authentication-app/api/libs/Slim/Middleware/PrettyExceptions.php(67): SlimMiddlewareMethodOverride->call()
    #8 /Applications/MAMP/htdocs/angularcode-authentication-app/api/libs/Slim/Slim.php(1254): SlimMiddlewarePrettyExceptions->call()
    #9 /Applications/MAMP/htdocs/angularcode-authentication-app/api/v1/index.php(53): SlimSlim->run()
    #10 {main}

  • Francisco Conejeros

    Hi, Thanks for sharing your Job.
    I have a litle problem.
    I downloaded and instaled in my apache with mysql.
    I modified the config.php with my own mySQL data.
    But the buttons, Login and signup, does not work.

    Debugging, i’ve foud this error:

    – 404 Not Found
    The requested URL /demos/angularcode-authentication-app/api/v1/session was not found on this server.

    Can you give some tips to resolve this?

    Thanks a lot

  • Baga

    Hello. Can anyone tell me how to disable autofiil form pasword in Chrome like in this demo?

  • santhu

    can u explain about “rewrite_module”?

    where it is availabe and what we need to write?