0

I want to conver my existing site to angularJS application. Its flow is like this. My parent web site is having link to sign up or login page. As per user selection signup or login page should open.So once user login or created account he pointed to dashboard page.So how to do this angularJS? Please note my parent web site is not in angular.

Thanks in advnce.

dip
  • 1,241
  • 2
  • 18
  • 32
  • possible duplicate of [How to handle authentication in Angular JS application](http://stackoverflow.com/questions/18288329/how-to-handle-authentication-in-angular-js-application) – Sam P May 27 '14 at 07:00
  • Thanks Sam. But in my application , i want to create login page and signup page both. – dip May 27 '14 at 07:07
  • The signup page is a simple HTML form page. Same as the login page. The server needs to save the session data after login. – Sam P May 27 '14 at 07:49

1 Answers1

0

Here is a suggested design and here is a little project I wrote that has Angular code authenticating with a PHP server. The code has both the Register and Log in options you are looking for.

  1. Use token based authentication (Im assuming your angular requests are JSON)

  2. After the user logs in or registers, send a bearer token back to Angular via the URL. On the server side set an expiry date for the token

  3. Every http request you make can include the token in the http header

The sample code has this implemented.

rameshpa
  • 555
  • 5
  • 5