Coder Social home page Coder Social logo

Comments (4)

fnakstad avatar fnakstad commented on July 30, 2024

Hi Michael,
I guess you could handle it in the same way as with the user role; just put the username in a cookie on the server-side when someone logs in, which you then can read into a $rootScope property when the Angular app has initialized. It's a pretty common use-case though, so I'll try to update my example with that functionality tomorrow. Thanks for the feedback!

from angular-client-side-auth.

fnakstad avatar fnakstad commented on July 30, 2024

I've updated the example to display username and indicate the role of the logged in user. You can check it out at: http://angular-client-side-auth.herokuapp.com/
I implemented it by setting a user cookie containing both username and role when a full page reload is requested. Furthermore, the login and register actions also return a user object of the same sort. Take a look at the code and example site, and let me know if something is unclear.

from angular-client-side-auth.

michaeljoser avatar michaeljoser commented on July 30, 2024

that's super nice and really fits my needs. Cheers :)

from angular-client-side-auth.

fnakstad avatar fnakstad commented on July 30, 2024

No problem :) Good luck with your project!

from angular-client-side-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.