Authenticate in angularJS with $ scope?

0

the question has arisen because my login is something different because when validating a user in the WS, this has to return data in JSON, because with that data I consult another WS to receive new data and display them in the view

I am trying with NG-cookies, that is, if the authentication happens, I save the data in a cookie:

cookieStore.put('nombreCookie',response);

When the page is refreshed, the data will not be lost because the data is stored in a variable called at the beginning of the session. logindata which is the one I use to make the requests but since it is only loaded when the session is started they are not saved and it causes that to refresh the page no more data ...

I want to know how I can send as a parameter the data stored in the cookie ...

Greetings.

    
asked by Hernan Humaña 20.09.2016 в 23:17
source

1 answer

1

If your application is going to consume two or more WSs, I would recommend that you use JWT token authentication.

If you use cookies you should be careful when creating them because you will have problems if your WS are hosted in different domains by that of Access-Control-Allow-Origin .

here I leave some information about it. WHAT IS AUTHENTICATION BASED ON TOKEN?

I also recommend this module for angular, it is very simple and it is easy to integrate with different authentication systems oauth2 Satellizer

Greetings.

    
answered by 21.09.2016 в 01:51