This project is generated with yo angular generator version 0.16.0.
It is just an example that we found.
This project is just an example how we did it, by using angular-oauth2 library and some parts from witoldsz/angular-http-auth.
There are better ways to do it, I am sure this code can be improved, but I wanted to share it, so maybe one day it will help someone.
app/
scripts/
services/
httpbuffer.js - witoldsz lib file
httpinterceptor.js - file that checks the call statuses
user.js - file where we treate the refresh token, login and logout
app.js - set the interceptor and the OAuth setup
For the lib that we partially used to create what we needed:
For the post that helped find this library: