angularjs - Securing Angular Application -
i creating angular application, , having trouble wrapping head around proper way ensure application , users secure.
i've been reading around many stack discussions, believe missing core understanding of happening, please correct errors see written below.
so far have sinatra server many (currently hypothetical) resource routes. user can create account using email address , password stored in database after being hashed bcrypt. when user logs in, record retrieved database email , password checked authentication. point not sure how proceed.
prior have set session variable , had server check variable exists in order correctly route logged in users. application (currently) single html page uses angular , ui-router display different content, of requests returning json content.
it understanding restful applications should not use sessions, or rather server should respond identically identical requests , not have own data shapes response. but if not store in session variable, how server know client making request has correct permissions? , sessions not stored in browser anyway, not part of server?
i believe have read, possible create token large random string, return string client , store in database timestamp. client provides token when making requests , server hits database verify exists , valid. client not have store string in cookie? suppose angular application store token in variable, persist while using ui-router not if users navigates using address bar.
i not understand how basic auth may or may not fit picture. appreciated, pointer resources may find better understanding of these concepts in general.
you want read on jwt. there jwt libraries ruby , angular.
i know aren't using node backend easy way see pieces working run angular-fullstack yeoman generator. uses jwt , code easy follow.
Comments
Post a Comment