I've been googling more than a day now. May be I'm missing the correct keywords.
I have the following setup:
Both run on the same server.
Calls to the api (mydomain/api/) are proxied to 127.0.0.1:3000
For api calls which require authorization I will use JWT and user authentication.
What I want to achieve is that I generate a token for my angular2 app which is allowed/required to make the public calls (listings of products for example).
This token needs to be transferred securely of course as I don't want others obtain my products and prices via direct api calls (with a stolen token).
Any help appreciated.
First, as @eesdil said, you must use HTTPS. In that case, all your calls are encrypted and safe.
In my example ( Angular 2, Express and JWT ), i used crypto module with pbkdf2 algorithm for hashing passwords.
This is workflow:
Working example is here: https://github.com/vladotesanovic/angular2-express-starter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With