javascript - Ionic authentication for login with angularjs -
as ionic uses angularjs, login system there isn't browser save cookie or session in order authenticate each part of application. 1 way protecting using in app.js
:
$urlrouterprovider.otherwise('/login');
because 1 doesn't access other links application. when returned answer server (mysql database) true , can use this:
$state.go('app.main');
is idea? or other ways?
since ionic
calls end api, can implement standard api authentication mechanism.
the common have toke based authentication, high level workflow can follows
1 - ionic
app calls backend server end point , token (by passing kind of encrypted key)
2 - end server generates token (ideal given time period) , sends ionic
app.
3 - there after, in every request ionic
sends token. (ideally in request header)
to save token temporary , can use simple storage solutions ng-storage or sqlite
have read here
Comments
Post a Comment