The backend of my app uses a rest api that requires the user to login via basic auth. This means every call they make requires them to send the username and password. But I want my app to hide this detail from the user. Yes, they will have a login page where they enter the username and password in, but from then on they should have no idea they're sending the username/password for every backend call.
My question is, how do I save the username/password on the client after the user submits on the login page so it can be used on every rest call thereafter?
This is almost my question, but the difference is
- I'm not using a constant like he is
- My value can't be initialized at module config time
- I'm not sure if this answer is idiomatic
Side Note: I'm sure some people will leave comments saying, "You shouldn't do that!" Fair enough, but that doesn't answer my question. There are other use cases out there where you need to store a value on the client side that can only be initialized after an action. This is what I'd like to learn.