Loopback Client Side Authentication

Is it possible to use client side authentication using the standard Loopback authentication / user model? I don't want to rely only on client side validations, but for something as simple as showing a "log out" button when the user logs in, it would be helpful to validate this on the client side.

I really want to change the DOM in Angular based on the isAuthenticated function response or something similar.

Thanks for any help.


source to share

2 answers

There is actually an isAuthenticated function in the Loopback Angular SDK. Link here: https://github.com/strongloop/loopback-sdk-angular/blob/fb161b7eaa02df877fe894daa54e4bd0fa4e041e/CHANGES.md



Hmm ... If the user was logged in, you would receive a response access token in response, which you use for all future API calls. If you have a token, they are authenticated. If you're not sure if this is a valid token, you can simply push /User/[id]?access_token=[token]

- if that fails, they no longer authenticate.



All Articles